树莓派支持在通过网络对其GPIO进行控制,需要开启该功能
1、配置树莓派
通过树莓派的首选项中的“Raspberry Pi Configuration”,或者通过窗口命令:
sudo raspi-config
打开配置对话框。通过其中的interface options

选 中Remote GPIO

选 yes

来使能远程GPIO功能
2.启动GPIO守候程序
(1)设置自动启动功能
使用systemctl命令设置启动自动运行GPIO远程有台守候程序:
sudo systemctl enable pigpiod
(2)启动GPIOD
sudo systemctl start pigpiod
搜索
复制