#!/usr/bin/env python3 """ Circle test: n1=50, n2=100, n3=200, n4=0 (Red) Runs forever Run with: mpremote run test/circle.py """ import patterns import utime import _thread from settings import Settings from machine import WDT print("Starting Circle Test: n1=50, n2=100, n3=200, n4=0 (Red)") print("Press Ctrl+C to stop") # Load settings settings = Settings() # Initialize patterns using settings p = patterns.Patterns( pin=settings["led_pin"], num_leds=settings["num_leds"], brightness=255, delay=2000 ) # Configure test parameters p.n1 = 50 # Head moves 50 LEDs/second p.n2 = 100 # Max length 100 LEDs p.n3 = 200 # Tail moves 200 LEDs/second p.n4 = 0 # Min length 0 LEDs p.colors = [(255, 0, 0)] # Red print(f"LED Pin: {settings['led_pin']}") print(f"LEDs: {settings['num_leds']}") print(f"Brightness: {p.brightness}") print(f"Parameters: n1={p.n1}, n2={p.n2}, n3={p.n3}, n4={p.n4}") print(f"Color: {p.colors[0]}") # Initialize watchdog timer wdt = WDT(timeout=10000) wdt.feed() # Start pattern p.select("circle") if p.selected in p.patterns: _thread.start_new_thread(p.patterns[p.selected], ()) print("Pattern started. Running forever...") else: print(f"Pattern {p.selected} not found") # Run forever try: while True: wdt.feed() utime.sleep_ms(100) except KeyboardInterrupt: print("\nStopping...") p.running = False p.off() print("LEDs turned off")