Add pattern test
This commit is contained in:
34
test/patterns/bidirectional_scanner.py
Normal file
34
test/patterns/bidirectional_scanner.py
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/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)
|
||||
p.set_param("br", 127)
|
||||
p.set_param("dl", 50)
|
||||
p.set_param("cl", [(0, 255, 0), (0, 255, 0)])
|
||||
p.set_param("pt", "bidirectional_scanner")
|
||||
|
||||
start = utime.ticks_ms()
|
||||
while utime.ticks_diff(utime.ticks_ms(), start) < 1500:
|
||||
p.tick()
|
||||
wdt.feed()
|
||||
utime.sleep_ms(10)
|
||||
|
||||
p.set_param("pt", "off")
|
||||
p.tick()
|
||||
utime.sleep_ms(100)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user