简体   繁体   English

用Raspberry Pi和Python控制RGB LED灯

[英]Controlling RGB LED Light with Raspberry Pi and Python

I bought this LED light on ebay . 我在ebay上买了这个LED灯 The model is CJMCU-KZQ. 型号为CJMCU-KZQ。

My question is, how can I get it to work on a raspberry pi and python? 我的问题是,如何使它在树莓派和python上运行? I have looked everywhere but cannot find any documentation for it. 我到处都看过,但是找不到任何文档。 Also, keep in mind that this light uses SDA/SCL I2C bus. 另外,请记住,该指示灯使用SDA / SCL I2C总线。

Looking at the ebay page, it suggests that it uses WS2812 driver to control the LED. 查看ebay页面,它表明它使用WS2812驱动器来控制LED。 Thankfully, that LED driver is pretty common, which means there is plenty of available (and open-soure) code for it. 值得庆幸的是,LED驱动器非常普遍,这意味着它有很多可用的(开放源代码)代码。

Documentation for WS2812 driver: https://cdn-shop.adafruit.com/datasheets/WS2812.pdf WS2812驱动程序的文档: https ://cdn-shop.adafruit.com/datasheets/WS2812.pdf

Tutorial on how to use LED strip with WS2812 driver: https://tutorials-raspberrypi.com/connect-control-raspberry-pi-ws2812-rgb-led-strips/ WS2812驱动程序如何使用LED灯条的教程: https ://tutorials-raspberrypi.com/connect-control-raspberry-pi-ws2812-rgb-led-strips/

The tutorial is great as covers every step of the process. 该教程很棒,涵盖了该过程的每个步骤。 They end up using the rpi_ws281x python wrapper which has been compiled from c. 他们最终使用从c编译的rpi_ws281x python包装器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM