|
楼主 |
发表于 2020-5-5 15:26
|
显示全部楼层
14、P24灯环4色流水钟摆灯
#MicroPython动手做(13)——掌控板之RGB三色灯
#P24灯环4色流水钟摆灯
[mw_shl_code=python,true]#MicroPython动手做(13)——掌控板之RGB三色灯
#P24灯环4色流水钟摆灯
from mpython import *
import neopixel
import time
my_rgb = neopixel.NeoPixel(Pin(Pin.P8), n=24, bpp=3, timing=1)
while True:
for i in range(23, -1, -1):
my_rgb = (30, 30, 30)
my_rgb.write()
time.sleep_ms(30)
my_rgb.fill( (0, 0, 0) )
my_rgb.write()
for i in range(24):
my_rgb = (0, 30, 0)
my_rgb.write()
time.sleep_ms(30)
my_rgb.fill( (0, 0, 0) )
my_rgb.write()
for i in range(23, -1, -1):
my_rgb = (50, 0, 0)
my_rgb.write()
time.sleep_ms(30)
my_rgb.fill( (0, 0, 0) )
my_rgb.write()
for i in range(24):
my_rgb = (0, 0, 180)
my_rgb.write()
time.sleep_ms(30)
my_rgb.fill( (0, 0, 0) )
my_rgb.write()[/mw_shl_code]
|
|