制作坊microbit红绿灯 专区

microbit红绿灯

吴文睿2020-04-11 467人围观
由于microbit滚动数字太慢,我就把数字调小了一点
要求同microbit彩灯
microbit *1
migicbit扩展板(或者robotbit及superbit) *1
delay = 0
_1 = magicbit.rgb().range(0, 4)
_2 = magicbit.rgb().range(0, 4)
_3 = magicbit.rgb().range(0, 4)
def on_forever():
delay = 30
_1.showColor(neopixel.colors(NeoPixelColors.RED))
_2.showColor(neopixel.colors(NeoPixelColors.RED))
_3.showColor(neopixel.colors(NeoPixelColors.RED))
for i in range(30):
basic.show_number(delay)
delay += -1
delay = 5
_1.showColor(neopixel.colors(NeoPixelColors.YELLOW))
_2.showColor(neopixel.colors(NeoPixelColors.YELLOW))
_3.showColor(neopixel.colors(NeoPixelColors.YELLOW))
for j in range(5):
basic.show_number(delay)
delay += -1
delay = 30
_1.showColor(neopixel.colors(NeoPixelColors.GREEN))
_2.showColor(neopixel.colors(NeoPixelColors.GREEN))
_3.showColor(neopixel.colors(NeoPixelColors.GREEN))
for k in range(30):
basic.show_number(delay)
delay += -1
basic.forever(on_forever)
1 +1

评论