Add flicker and n_chase patterns, increase test brightness to 255, add test suites
This commit is contained in:
58
test/n_chase/1.py
Normal file
58
test/n_chase/1.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
N-chase test 1: Red, on=5, off=5, delay=100ms
|
||||
Runs forever
|
||||
Run with: mpremote run test/n_chase/1.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting N-Chase Test 1: Red, on=5, off=5, delay=100ms")
|
||||
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=100
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 5 # On width 5
|
||||
p.n2 = 5 # Off width 5
|
||||
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"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")
|
||||
|
||||
58
test/n_chase/2.py
Normal file
58
test/n_chase/2.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
N-chase test 2: Green, on=10, off=5, delay=150ms
|
||||
Runs forever
|
||||
Run with: mpremote run test/n_chase/2.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting N-Chase Test 2: Green, on=10, off=5, delay=150ms")
|
||||
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=150
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 10 # On width 10
|
||||
p.n2 = 5 # Off width 5
|
||||
p.colors = [(0, 255, 0)] # Green
|
||||
|
||||
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")
|
||||
|
||||
58
test/n_chase/3.py
Normal file
58
test/n_chase/3.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
N-chase test 3: Blue, on=3, off=10, delay=80ms
|
||||
Runs forever
|
||||
Run with: mpremote run test/n_chase/3.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting N-Chase Test 3: Blue, on=3, off=10, delay=80ms")
|
||||
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=80
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 3 # On width 3
|
||||
p.n2 = 10 # Off width 10
|
||||
p.colors = [(0, 0, 255)] # Blue
|
||||
|
||||
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")
|
||||
|
||||
58
test/n_chase/4.py
Normal file
58
test/n_chase/4.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
N-chase test 4: Yellow, on=7, off=7, delay=120ms
|
||||
Runs forever
|
||||
Run with: mpremote run test/n_chase/4.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting N-Chase Test 4: Yellow, on=7, off=7, delay=120ms")
|
||||
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=120
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 7 # On width 7
|
||||
p.n2 = 7 # Off width 7
|
||||
p.colors = [(255, 255, 0)] # Yellow
|
||||
|
||||
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")
|
||||
|
||||
58
test/n_chase/5.py
Normal file
58
test/n_chase/5.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
N-chase test 5: White, on=2, off=8, delay=200ms
|
||||
Runs forever
|
||||
Run with: mpremote run test/n_chase/5.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting N-Chase Test 5: White, on=2, off=8, delay=200ms")
|
||||
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=200
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 2 # On width 2
|
||||
p.n2 = 8 # Off width 8
|
||||
p.colors = [(255, 255, 255)] # White
|
||||
|
||||
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")
|
||||
|
||||
58
test/n_chase/6.py
Normal file
58
test/n_chase/6.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/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")
|
||||
|
||||
58
test/n_chase/7.py
Normal file
58
test/n_chase/7.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
N-chase test 7: Cyan, on=4, off=12, delay=180ms
|
||||
Runs forever
|
||||
Run with: mpremote run test/n_chase/7.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting N-Chase Test 7: Cyan, on=4, off=12, delay=180ms")
|
||||
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=180
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 4 # On width 4
|
||||
p.n2 = 12 # Off width 12
|
||||
p.colors = [(0, 255, 255)] # Cyan
|
||||
|
||||
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")
|
||||
|
||||
58
test/n_chase/8.py
Normal file
58
test/n_chase/8.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
N-chase test 8: Orange, on=1, off=20, delay=250ms
|
||||
Runs forever
|
||||
Run with: mpremote run test/n_chase/8.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting N-Chase Test 8: Orange, on=1, off=20, delay=250ms")
|
||||
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=250
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 1 # On width 1
|
||||
p.n2 = 20 # Off width 20
|
||||
p.colors = [(255, 128, 0)] # Orange
|
||||
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user