MV001-V1200说明 点灯代码
import RPi.GPIO as GPIO
import time
# 设置GPIO模式为BCM
GPIO.setmode(GPIO.BCM)
# 定义LED灯连接的引脚
led_pins = [17, 27, 22, 5, 6, 13, 19, 26]
# 设置引脚为输出模式
for pin in led_pins:
GPIO.setup(pin, GPIO.OUT)
# 循环点亮和熄灭LED灯
while True:
for pin in led_pins:
GPIO.output(pin, GPIO.HIGH) # 点亮LED灯
time.sleep(0.5) # 延时0.5秒
GPIO.output(pin, GPIO.LOW) # 熄灭LED灯
time.sleep(1) # 延时1秒
# 清理GPIO资源
GPIO.cleanup()
标签:LED,点灯,pin,time,pins,GPIO,led,V1200,MV001
From: https://blog.51cto.com/u_15917081/9158559