简介
使用GPIO Zero library 的 Python库实现点亮LED灯。
接线
树莓派引脚参考图如下:
 
 LED正极 接GPIO17
 LED负极 接GND
权限
将你的用户加到gpio组中, 否则无法控制GPIO
 sudo usermod -a -G gpio 
代码
from gpiozero import LED
from time import sleep
led = LED(17)
while True:
    led.on()
    sleep(1)
    led.off()
    sleep(1)
参考
Raspberry Pi hardware - GPIO and the 40-pin header
 GPIO in Python - LED示例










