59 lines
1.2 KiB
Python
59 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
N-chase test 6: Magenta, on=15, off=3, delay=60ms
|
|
Runs forever
|
|
Run with: mpremote run test/n_chase/6.py
|
|
"""
|
|
|
|
import patterns
|
|
import utime
|
|
from settings import Settings
|
|
from machine import WDT
|
|
|
|
print("Starting N-Chase Test 6: Magenta, on=15, off=3, delay=60ms")
|
|
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=60
|
|
)
|
|
|
|
# Configure test parameters
|
|
p.n1 = 15 # On width 15
|
|
p.n2 = 3 # Off width 3
|
|
p.colors = [(255, 0, 255)] # Magenta
|
|
|
|
print(f"LED Pin: {settings['led_pin']}")
|
|
print(f"LEDs: {settings['num_leds']}")
|
|
print(f"Brightness: {p.brightness}")
|
|
print(f"Delay: {p.delay}ms")
|
|
print(f"On width: {p.n1}")
|
|
print(f"Off width: {p.n2}")
|
|
print(f"Color: {p.colors[0]}")
|
|
|
|
# Initialize watchdog timer
|
|
wdt = WDT(timeout=10000)
|
|
wdt.feed()
|
|
|
|
# Start pattern
|
|
p.select("nc")
|
|
print("Pattern started. Running forever...")
|
|
|
|
# Run forever
|
|
try:
|
|
while True:
|
|
wdt.feed()
|
|
utime.sleep_ms(100)
|
|
except KeyboardInterrupt:
|
|
print("\nStopping...")
|
|
p.run = False
|
|
p.off()
|
|
print("LEDs turned off")
|
|
|