46 lines
940 B
Python
46 lines
940 B
Python
#!/usr/bin/env python3
|
|
import utime
|
|
from machine import WDT
|
|
from settings import Settings
|
|
from patterns import Patterns
|
|
|
|
|
|
def run():
|
|
s = Settings()
|
|
pin = s.get("led_pin", 10)
|
|
num = s.get("num_leds", 30)
|
|
|
|
p = Patterns(pin=pin, num_leds=num)
|
|
wdt = WDT(timeout=10000)
|
|
|
|
# Baseline params
|
|
p.set_param("br", 64)
|
|
p.set_param("dl", 500)
|
|
p.set_param("cl", [(255, 0, 0), (0, 0, 255)])
|
|
p.set_param("n1", 200)
|
|
p.set_param("n2", 200)
|
|
p.set_param("n3", 1)
|
|
p.set_param("n4", 1)
|
|
|
|
for name, fn in p.patterns.items():
|
|
if fn is None:
|
|
continue
|
|
print(name)
|
|
p.set_param("pt", name)
|
|
|
|
start = utime.ticks_ms()
|
|
while utime.ticks_diff(utime.ticks_ms(), start) < 2000:
|
|
p.tick()
|
|
wdt.feed()
|
|
utime.sleep_ms(10)
|
|
|
|
p.set_param("pt", "off")
|
|
p.tick()
|
|
utime.sleep_ms(200)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
run()
|
|
|
|
|