与树莓派连接
红色------5V
白色------GND
绿色-----GPIO18(树莓派第12个引脚)
代码
GitHub:git clone https://github.com/jgarff/rpi_ws281x
首先需要安装相关库:最好用pip3安装,这样python3就可以运行程序
sudo pip3 install rpi-ws281x
若没有安装pip的还得先安装pip和pip3:(装了则跳过此步骤)
sudo apt-get install python-pip3
要求-Limitations:
PWM
Since this library and the onboard Raspberry Pi audio both use the PWM, they cannot be used together. You will need to blacklist the Broadcom audio kernel module by creating a file sudo nano /etc/modprobe.d/snd-blacklist.conf
with
编辑/etc/modprobe.d