0
点赞
收藏
分享

微信扫一扫

FFMpeg - macOS build 报错 : xcrun -sdk iphoneos clang ...

梦想家们 2024-05-02 阅读 15

简介

使用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示例

举报

相关推荐

0 条评论