一个简单但强大的库来控制ws2812b的led面板。
ledwall的Python项目详细描述
LED墙Python库
一个简单但功能强大的python库来操作ws2812b led面板。 面板可以通过USB电缆连接或通过UDP访问。这个库只支持Python3,但与操作系统无关。
该库打算与a a-arduino或nodemcu-tat控制一束led一起使用。当然,您可以使用ArduinoIDE在C中直接编写草图来控制LED。但在树莓或其他电脑上使用Python将为你提供更多的灵活性和开发速度。此外,您可以利用范围广泛的现有Python库。只需几行代码,您就可以使用很棒的输入library集成游戏板。
有关更多信息、示例、安装指南和arduino/nodemcu草图,请查看my gitrepository。
库的online documentation也可以在readthedocs <https://readthedocs.org>
上找到。
示例脚本
下面的脚本显示了库的基本用法。我试着让一切都像Python一样。
importledwall.componentsascomp# Create a new display instance. Using a SerialSender to# send the color data to the arduino.# Setting the desired framerate is 15s=comp.SerialSender(portName='/dev/ttyACM0',baudrate=1000000)d=comp.Display(16,32,s,framerate=15)# Defining a few basic colorsred=comp.RGBColor.fromIntValues(255,0,0)green=comp.RGBColor.fromIntValues(0,255,0)d.fill(green)d.setPixel(0,3,red)d.setPixel(14,23,red)d.update()