我试图让led像秒针一样向前移动
np = neopixel.NeoPixel(machine.Pin(2), led)
while True:
t = utime.localtime()
h = int(utime.localtime()[3]) + time_zone
m = utime.localtime()[4]
s = utime.localtime()[5]
np[h] = (64, 64, 64)
np[m] = (64, 64, 64)
np[s] = (64, 64, 64)#turn on
time.sleep(1)
sc = s - 1
np[sc] = (0, 0, 0)#turn off
np.write()
但我认为我的代码不是一个好主意
我不完全清楚您希望显示器的外观,但这可能会有所帮助。使用下面的代码,“秒”led将永远不会覆盖“小时”或“分钟”led
关键的是,我们还将除当前小时、分钟和秒点亮的LED之外的所有设备重置为“关闭”
我自己没有Neopix,所以我写了一个simulator,我用它来用常规Python测试
相关问题 更多 >
编程相关推荐