HaloCode光環板簡介
import event, halo
import random
index = 0
@event.button_pressed
def on_start():
global index
index = 1
old_index = 1
init_delay = 0.01
while True:
halo.led.show_single(old_index, 0, 0, 0)
halo.led.show_single(index, 255, 255, 0)
old_index = index
index = index + 1
if index > 12:
index = 1
time.sleep(init_delay)
init_delay += 0.01
if init_delay > 0.5 and random.randint(1, 10) == 1:
breakLast updated
Was this helpful?