TA的每日心情 | 奋斗 2019-12-1 10:07 |
---|
签到天数: 1617 天 连续签到: 1 天 [LV.Master]伴坛终老
|
使用microbit控制WS2812彩灯,DIY一个圣诞彩灯,可以自己编程实现各种效果。
简单的参考程序- from microbit import *
- import neopixel
- np = neopixel.NeoPixel(pin0, 24)
- while True:
- for pixel_id in range(0, len(np)):
- red = (64,0,0)
- np[pixel_id] = (red)
- np.show()
- sleep(10)
- for pixel_id in range(0, len(np)):
- green = (0,64,0)
- np[pixel_id] = (green)
- np.show()
- sleep(10)
- for pixel_id in range(0, len(np)):
- blue = (0,0,64)
- np[pixel_id] = (blue)
- np.show()
- sleep(10)
复制代码 效果图
完整的项目介绍:
http://bigl.es/have-yourself-a-ws2812b-christmas/
|
|