Initial commit

This commit is contained in:
2025-12-03 13:36:19 +13:00
parent 59e42c35e1
commit 45855cf453
18 changed files with 2153 additions and 168 deletions

39
test/patterns/on.py Normal file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env python3
import utime
from machine import WDT
from settings import Settings
from patterns import Patterns
def main():
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)
p.set_param("br", 64)
p.set_param("dl", 120)
p.set_param("cl", [(255, 0, 0), (0, 0, 255)])
# ON phase
p.select("on")
start = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start) < 800:
wdt.feed()
p.tick()
utime.sleep_ms(10)
# OFF phase
p.select("off")
start = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start) < 100:
wdt.feed()
p.tick()
utime.sleep_ms(10)
if __name__ == "__main__":
main()