Add flicker and n_chase patterns, increase test brightness to 255, add test suites

This commit is contained in:
2025-10-26 18:49:45 +13:00
parent 83cb34d6a8
commit b13ec01561
30 changed files with 1695 additions and 32 deletions

View File

@@ -26,6 +26,9 @@ class Patterns(PatternBase): # Inherit from PatternBase
"bl": self.blink, "bl": self.blink,
"cl": self.circle_loading, "cl": self.circle_loading,
"sb": self.sine_brightness, "sb": self.sine_brightness,
"rb": self.rainbow,
"fl": self.flicker,
"nc": self.n_chase,
} }
self.step = 0 self.step = 0
self.run = True self.run = True
@@ -185,6 +188,155 @@ class Patterns(PatternBase): # Inherit from PatternBase
self.run = False self.run = False
self.running = False self.running = False
def rainbow(self):
"""Rainbow pattern - delay = cycle time, n1 = number of nodes"""
self.run = True
# Calculate timing
cycle_time = max(100, self.delay) # delay = total cycle time in ms
num_nodes = max(1, int(self.n1)) # n1 = number of rainbow nodes/segments
steps_per_cycle = 360 # 360 steps for full cycle
step_delay = cycle_time // steps_per_cycle # ms per step
last_update = utime.ticks_ms()
while self.run:
self.wdt.feed()
current_time = utime.ticks_ms()
# Update rainbow every step_delay ms
if utime.ticks_diff(current_time, last_update) >= step_delay:
# Clear all LEDs
self.n.fill((0, 0, 0))
# Create rainbow effect with n1 nodes
for i in range(self.num_leds):
# Calculate hue based on LED position, number of nodes, and time
hue_per_node = 360 // num_nodes
node_index = i * num_nodes // self.num_leds
base_hue = node_index * hue_per_node
hue = (base_hue + self.step) % 360
# Convert HSV to RGB
rgb = self.hsv_to_rgb(hue, 255, self.brightness)
self.n[i] = rgb
self.n.write()
self.step = (self.step + 1) % 360 # Increment step for animation
last_update = current_time
self.run = False
self.running = False
def hsv_to_rgb(self, h, s, v):
"""Convert HSV to RGB"""
h = h % 360
s = min(255, max(0, s))
v = min(255, max(0, v))
c = v * s // 255
x = c * (60 - abs((h % 120) - 60)) // 60
m = v - c
if h < 60:
r, g, b = c, x, 0
elif h < 120:
r, g, b = x, c, 0
elif h < 180:
r, g, b = 0, c, x
elif h < 240:
r, g, b = 0, x, c
elif h < 300:
r, g, b = x, 0, c
else:
r, g, b = c, 0, x
return (r + m, g + m, b + m)
def flicker(self):
"""Flicker pattern - random brightness variation on base color"""
self.run = True
base_color = self.colors[0]
# n1 = minimum brightness (default to 10 if not set)
min_brightness = max(0, int(self.n1)) if hasattr(self, 'n1') and self.n1 > 0 else 10
# Calculate update rate from delay (n3 is not used, delay controls speed)
update_delay = max(10, int(self.delay)) # At least 10ms to avoid too fast updates
last_update = utime.ticks_ms()
while self.run:
self.wdt.feed()
current_time = utime.ticks_ms()
# Update flicker every update_delay ms
if utime.ticks_diff(current_time, last_update) >= update_delay:
# Calculate random brightness variation
# Flicker between min_brightness and full brightness
max_flicker = self.brightness - min_brightness
flicker_offset = random.randint(0, max(max_flicker, 1))
flicker_brightness = min_brightness + flicker_offset
# Apply brightness to color
flicker_color = (
int(base_color[0] * flicker_brightness / 255),
int(base_color[1] * flicker_brightness / 255),
int(base_color[2] * flicker_brightness / 255)
)
self.fill(flicker_color)
self.n.write()
last_update = current_time
utime.sleep_ms(1)
self.run = False
self.running = False
def n_chase(self):
"""Chase pattern - n1 LEDs on, n2 LEDs off, moving forward"""
self.run = True
# n1 = on width, n2 = off width
on_width = max(1, int(self.n1))
off_width = max(0, int(self.n2))
segment_length = on_width + off_width
if segment_length == 0:
segment_length = 1
# Calculate timing from delay
step_delay = max(10, int(self.delay)) # At least 10ms
step = 0
last_update = utime.ticks_ms()
color = self.apply_brightness(self.colors[0])
while self.run:
self.wdt.feed()
current_time = utime.ticks_ms()
# Move forward every step_delay ms
if utime.ticks_diff(current_time, last_update) >= step_delay:
# Clear all LEDs
self.n.fill((0, 0, 0))
# Draw the chase pattern - repeating segments across all LEDs
for i in range(self.num_leds):
pos_in_segment = (i + step) % segment_length
if pos_in_segment < on_width:
self.n[i] = color
self.n.write()
step = (step + 1) % segment_length
last_update = current_time
utime.sleep_ms(1)
self.run = False
self.running = False
# def flicker(self): # def flicker(self):
# current_time = utime.ticks_ms() # current_time = utime.ticks_ms()
# base_color = self.colors[0] # base_color = self.colors[0]

View File

@@ -6,17 +6,32 @@ Run with: mpremote run test/blink.py
import patterns import patterns
import utime import utime
from settings import Settings
from machine import WDT
def test_blink(): def test_blink():
print("Testing blink pattern...") print("Testing blink pattern...")
# Initialize patterns with LED pin 10 and 59 LEDs at 20% brightness # Initialize watchdog timer
p = patterns.Patterns(pin=10, num_leds=59, brightness=51, delay=500) wdt = WDT(timeout=10000) # 10 second timeout
wdt.feed()
# Load settings
settings = Settings()
# Initialize patterns using settings
p = patterns.Patterns(
pin=settings["led_pin"],
num_leds=settings["num_leds"], # Set to 200 LEDs for test
brightness=255, # Full brightness
delay=500
)
# Set a bright red color # Set a bright red color
p.colors = [(255, 0, 0)] # Red p.colors = [(255, 0, 0)] # Red
print(f"LEDs: {p.num_leds}") print(f"LED Pin: {settings['led_pin']}")
print(f"LEDs: {p.num_leds} (test override: 200)")
print(f"Brightness: {p.brightness}") print(f"Brightness: {p.brightness}")
print(f"Delay: {p.delay}ms") print(f"Delay: {p.delay}ms")
print(f"Color: {p.colors[0]}") print(f"Color: {p.colors[0]}")
@@ -25,8 +40,11 @@ def test_blink():
print("Starting blink pattern for 5 seconds...") print("Starting blink pattern for 5 seconds...")
p.select("bl") p.select("bl")
# Let it run for 5 seconds # Let it run for 5 seconds with WDT feeding
utime.sleep(5) start_time = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start_time) < 5000:
wdt.feed()
utime.sleep_ms(100)
# Stop the pattern # Stop the pattern
p.run = False p.run = False

58
test/circle/1.py Normal file
View File

@@ -0,0 +1,58 @@
#!/usr/bin/env python3
"""
Circle loading test 1: n1=50, n2=100, n3=200, n4=0 (Red)
Runs forever
Run with: mpremote run test/circle/1.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Circle Loading Test 1: 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("cl")
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/circle/2.py Normal file
View File

@@ -0,0 +1,58 @@
#!/usr/bin/env python3
"""
Circle loading test 2: n1=10, n2=30, n3=20, n4=5 (Green)
Runs forever
Run with: mpremote run test/circle/2.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Circle Loading Test 2: n1=10, n2=30, n3=20, n4=5 (Green)")
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 = 10 # Head moves 10 LEDs/second
p.n2 = 30 # Max length 30 LEDs
p.n3 = 20 # Tail moves 20 LEDs/second
p.n4 = 5 # Min length 5 LEDs
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"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("cl")
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/circle/3.py Normal file
View File

@@ -0,0 +1,58 @@
#!/usr/bin/env python3
"""
Circle loading test 3: n1=15, n2=25, n3=15, n4=3 (Blue)
Runs forever
Run with: mpremote run test/circle/3.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Circle Loading Test 3: n1=15, n2=25, n3=15, n4=3 (Blue)")
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 = 15 # Head moves 15 LEDs/second
p.n2 = 25 # Max length 25 LEDs
p.n3 = 15 # Tail moves 15 LEDs/second
p.n4 = 3 # Min length 3 LEDs
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"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("cl")
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/circle/4.py Normal file
View File

@@ -0,0 +1,58 @@
#!/usr/bin/env python3
"""
Circle loading test 4: n1=30, n2=40, n3=5, n4=8 (Yellow)
Runs forever
Run with: mpremote run test/circle/4.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Circle Loading Test 4: n1=30, n2=40, n3=5, n4=8 (Yellow)")
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 = 30 # Head moves 30 LEDs/second
p.n2 = 40 # Max length 40 LEDs
p.n3 = 5 # Tail moves 5 LEDs/second
p.n4 = 8 # Min length 8 LEDs
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"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("cl")
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/circle/5.py Normal file
View File

@@ -0,0 +1,58 @@
#!/usr/bin/env python3
"""
Circle loading test 5: n1=25, n2=60, n3=30, n4=2 (Magenta)
Runs forever
Run with: mpremote run test/circle/5.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Circle Loading Test 5: n1=25, n2=60, n3=30, n4=2 (Magenta)")
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 = 25 # Head moves 25 LEDs/second
p.n2 = 60 # Max length 60 LEDs
p.n3 = 30 # Tail moves 30 LEDs/second
p.n4 = 2 # Min length 2 LEDs
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"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("cl")
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/circle/6.py Normal file
View File

@@ -0,0 +1,58 @@
#!/usr/bin/env python3
"""
Circle loading test 6: n1=5, n2=20, n3=40, n4=1 (Cyan)
Runs forever
Run with: mpremote run test/circle/6.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Circle Loading Test 6: n1=5, n2=20, n3=40, n4=1 (Cyan)")
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 = 5 # Head moves 5 LEDs/second
p.n2 = 20 # Max length 20 LEDs
p.n3 = 40 # Tail moves 40 LEDs/second
p.n4 = 1 # Min length 1 LED
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"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("cl")
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/circle/7.py Normal file
View File

@@ -0,0 +1,58 @@
#!/usr/bin/env python3
"""
Circle loading test 7: n1=12, n2=15, n3=18, n4=4 (Orange)
Runs forever
Run with: mpremote run test/circle/7.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Circle Loading Test 7: n1=12, n2=15, n3=18, n4=4 (Orange)")
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 = 12 # Head moves 12 LEDs/second
p.n2 = 15 # Max length 15 LEDs
p.n3 = 18 # Tail moves 18 LEDs/second
p.n4 = 4 # Min length 4 LEDs
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"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("cl")
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/circle/8.py Normal file
View File

@@ -0,0 +1,58 @@
#!/usr/bin/env python3
"""
Circle loading test 8: n1=100, n2=50, n3=150, n4=10 (Purple)
Runs forever
Run with: mpremote run test/circle/8.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Circle Loading Test 8: n1=100, n2=50, n3=150, n4=10 (Purple)")
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 = 100 # Head moves 100 LEDs/second
p.n2 = 50 # Max length 50 LEDs
p.n3 = 150 # Tail moves 150 LEDs/second
p.n4 = 10 # Min length 10 LEDs
p.colors = [(128, 0, 255)] # Purple
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("cl")
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")

View File

@@ -46,7 +46,7 @@ def test_circle_loading():
p = patterns.Patterns( p = patterns.Patterns(
pin=settings["led_pin"], pin=settings["led_pin"],
num_leds=settings["num_leds"], num_leds=settings["num_leds"],
brightness=100, brightness=255,
delay=2000 # Base cycle time delay=2000 # Base cycle time
) )

56
test/flicker/1.py Normal file
View File

@@ -0,0 +1,56 @@
#!/usr/bin/env python3
"""
Flicker test 1: Red, delay=50ms, min brightness=50
Runs forever
Run with: mpremote run test/flicker/1.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Flicker Test 1: Red, delay=50ms, min brightness=50")
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=50
)
# Configure test parameters
p.n1 = 50 # Min brightness 50
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"Min brightness: {p.n1}")
print(f"Color: {p.colors[0]}")
# Initialize watchdog timer
wdt = WDT(timeout=10000)
wdt.feed()
# Start pattern
p.select("fl")
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")

56
test/flicker/2.py Normal file
View File

@@ -0,0 +1,56 @@
#!/usr/bin/env python3
"""
Flicker test 2: Green, delay=100ms, min brightness=100
Runs forever
Run with: mpremote run test/flicker/2.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Flicker Test 2: Green, delay=100ms, min brightness=100")
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 = 100 # Min brightness 100
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"Min brightness: {p.n1}")
print(f"Color: {p.colors[0]}")
# Initialize watchdog timer
wdt = WDT(timeout=10000)
wdt.feed()
# Start pattern
p.select("fl")
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")

56
test/flicker/3.py Normal file
View File

@@ -0,0 +1,56 @@
#!/usr/bin/env python3
"""
Flicker test 3: Blue, delay=200ms, min brightness=20
Runs forever
Run with: mpremote run test/flicker/3.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Flicker Test 3: Blue, delay=200ms, min brightness=20")
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 = 20 # Min brightness 20
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"Min brightness: {p.n1}")
print(f"Color: {p.colors[0]}")
# Initialize watchdog timer
wdt = WDT(timeout=10000)
wdt.feed()
# Start pattern
p.select("fl")
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")

56
test/flicker/4.py Normal file
View File

@@ -0,0 +1,56 @@
#!/usr/bin/env python3
"""
Flicker test 4: White, delay=80ms, min brightness=150
Runs forever
Run with: mpremote run test/flicker/4.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Flicker Test 4: White, delay=80ms, min brightness=150")
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 = 150 # Min brightness 150
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"Min brightness: {p.n1}")
print(f"Color: {p.colors[0]}")
# Initialize watchdog timer
wdt = WDT(timeout=10000)
wdt.feed()
# Start pattern
p.select("fl")
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")

56
test/flicker/5.py Normal file
View File

@@ -0,0 +1,56 @@
#!/usr/bin/env python3
"""
Flicker test 5: Yellow, delay=150ms, min brightness=30
Runs forever
Run with: mpremote run test/flicker/5.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Flicker Test 5: Yellow, delay=150ms, min brightness=30")
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 = 30 # Min brightness 30
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"Min brightness: {p.n1}")
print(f"Color: {p.colors[0]}")
# Initialize watchdog timer
wdt = WDT(timeout=10000)
wdt.feed()
# Start pattern
p.select("fl")
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")

56
test/flicker/6.py Normal file
View File

@@ -0,0 +1,56 @@
#!/usr/bin/env python3
"""
Flicker test 6: Magenta, delay=60ms, min brightness=80
Runs forever
Run with: mpremote run test/flicker/6.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Flicker Test 6: Magenta, delay=60ms, min brightness=80")
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 = 80 # Min brightness 80
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"Min brightness: {p.n1}")
print(f"Color: {p.colors[0]}")
# Initialize watchdog timer
wdt = WDT(timeout=10000)
wdt.feed()
# Start pattern
p.select("fl")
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")

56
test/flicker/7.py Normal file
View File

@@ -0,0 +1,56 @@
#!/usr/bin/env python3
"""
Flicker test 7: Cyan, delay=120ms, min brightness=5
Runs forever
Run with: mpremote run test/flicker/7.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Flicker Test 7: Cyan, delay=120ms, min brightness=5")
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 = 5 # Min brightness 5
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"Min brightness: {p.n1}")
print(f"Color: {p.colors[0]}")
# Initialize watchdog timer
wdt = WDT(timeout=10000)
wdt.feed()
# Start pattern
p.select("fl")
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")

56
test/flicker/8.py Normal file
View File

@@ -0,0 +1,56 @@
#!/usr/bin/env python3
"""
Flicker test 8: Orange, delay=40ms, min brightness=180
Runs forever
Run with: mpremote run test/flicker/8.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
print("Starting Flicker Test 8: Orange, delay=40ms, min brightness=180")
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=40
)
# Configure test parameters
p.n1 = 180 # Min brightness 180
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"Min brightness: {p.n1}")
print(f"Color: {p.colors[0]}")
# Initialize watchdog timer
wdt = WDT(timeout=10000)
wdt.feed()
# Start pattern
p.select("fl")
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")

View File

@@ -75,7 +75,7 @@ async def run_suite(uri: str):
i, i,
delay=cfg.get("delay"), delay=cfg.get("delay"),
colors=cfg.get("colors"), colors=cfg.get("colors"),
brightness=cfg.get("brightness", 127), brightness=cfg.get("brightness", 255),
num_leds=cfg.get("num_leds"), num_leds=cfg.get("num_leds"),
n1=cfg.get("n1"), n1=cfg.get("n1"),
n2=cfg.get("n2"), n2=cfg.get("n2"),

58
test/n_chase/1.py Normal file
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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")

117
test/rainbow.py Normal file
View File

@@ -0,0 +1,117 @@
#!/usr/bin/env python3
"""
Test script for rainbow pattern
Run with: mpremote run test/rainbow.py
"""
import patterns
import utime
from settings import Settings
from machine import WDT
def run_test_case(p, test_name, duration_ms=5000):
"""Run a test case for specified duration"""
print(f"\n--- {test_name} ---")
print(f"Parameters: n1={p.n1} nodes, delay={p.delay}ms cycle time, brightness={p.brightness}")
print(f"Running for {duration_ms//1000} seconds...")
# Initialize watchdog timer
wdt = WDT(timeout=10000)
wdt.feed()
# Start pattern
p.select("rb")
# Run for specified duration
start_time = utime.ticks_ms()
while utime.ticks_diff(utime.ticks_ms(), start_time) < duration_ms:
wdt.feed()
utime.sleep_ms(100)
# Stop pattern
p.run = False
print(f"{test_name} completed")
# Brief pause between tests
utime.sleep_ms(500)
def test_rainbow():
print("Testing rainbow pattern with multiple configurations...")
# Load settings
settings = Settings()
# Initialize patterns using settings
p = patterns.Patterns(
pin=settings["led_pin"],
num_leds=settings["num_leds"],
brightness=255, # Full brightness
delay=1000 # Base cycle time
)
print(f"LED Pin: {settings['led_pin']}")
print(f"LEDs: {settings['num_leds']}")
print(f"Base Brightness: {p.brightness}")
# Test Case 1: Single node rainbow (full spectrum)
p.n1 = 1 # 1 node (full spectrum)
p.delay = 3000 # 3 second cycle
p.brightness = 255 # Full brightness
run_test_case(p, "Test 1: Single node (full spectrum)", 12000)
# Test Case 2: Two node rainbow (red/green)
p.n1 = 2 # 2 nodes
p.delay = 2000 # 2 second cycle
p.brightness = 255 # Full brightness
run_test_case(p, "Test 2: Two nodes (red/green)", 10000)
# Test Case 3: Three node rainbow (RGB)
p.n1 = 3 # 3 nodes
p.delay = 1500 # 1.5 second cycle
p.brightness = 255 # Full brightness
run_test_case(p, "Test 3: Three nodes (RGB)", 9000)
# Test Case 4: Four node rainbow (RYGB)
p.n1 = 4 # 4 nodes
p.delay = 1000 # 1 second cycle
p.brightness = 255 # Full brightness
run_test_case(p, "Test 4: Four nodes (RYGB)", 8000)
# Test Case 5: Six node rainbow (ROYGBP)
p.n1 = 6 # 6 nodes
p.delay = 800 # 0.8 second cycle
p.brightness = 255 # Full brightness
run_test_case(p, "Test 5: Six nodes (ROYGBP)", 8000)
# Test Case 6: Eight node rainbow
p.n1 = 8 # 8 nodes
p.delay = 600 # 0.6 second cycle
p.brightness = 255 # Full brightness
run_test_case(p, "Test 6: Eight nodes", 6000)
# Test Case 7: Twelve node rainbow (fine gradation)
p.n1 = 12 # 12 nodes
p.delay = 400 # 0.4 second cycle
p.brightness = 255 # Full brightness
run_test_case(p, "Test 7: Twelve nodes (fine gradation)", 6000)
# Test Case 8: Many nodes, slow cycle
p.n1 = 20 # 20 nodes
p.delay = 2000 # 2 second cycle
p.brightness = 255 # Full brightness
run_test_case(p, "Test 8: Many nodes, slow cycle", 10000)
# Test Case 9: One second cycle
p.n1 = 5 # 5 nodes
p.delay = 1000 # 1 second cycle
p.brightness = 255 # Full brightness
run_test_case(p, "Test 9: One second cycle (5 nodes)", 6000)
print("\n=== All tests completed ===")
# Turn off LEDs
p.off()
print("LEDs turned off")
if __name__ == "__main__":
test_rainbow()

View File

@@ -46,7 +46,7 @@ def test_sine_brightness():
p = patterns.Patterns( p = patterns.Patterns(
pin=settings["led_pin"], pin=settings["led_pin"],
num_leds=settings["num_leds"], num_leds=settings["num_leds"],
brightness=51, # 20% brightness brightness=255, # Full brightness
delay=1000 # Base wavelength delay=1000 # Base wavelength
) )
@@ -55,60 +55,60 @@ def test_sine_brightness():
print(f"Base Brightness: {p.brightness}") print(f"Base Brightness: {p.brightness}")
# Test Case 1: Slow breathing # Test Case 1: Slow breathing
p.n1 = 10 # Min brightness 10 p.n1 = 50 # Min brightness 50
p.brightness = 40 # Max brightness 40 p.brightness = 255 # Max brightness 255
p.delay = 3000 # 3 second cycle p.delay = 3000 # 3 second cycle
p.colors = [(255, 0, 0)] # Red p.colors = [(255, 0, 0)] # Red
run_test_case(p, "Test 1: Slow breathing (10-40 brightness)", 12000) run_test_case(p, "Test 1: Slow breathing (50-255 brightness)", 12000)
# Test Case 2: Fast pulsing # Test Case 2: Fast pulsing
p.n1 = 5 # Min brightness 5 p.n1 = 100 # Min brightness 100
p.brightness = 51 # Max brightness 51 p.brightness = 255 # Max brightness 255
p.delay = 500 # 0.5 second cycle p.delay = 500 # 0.5 second cycle
p.colors = [(0, 255, 0)] # Green p.colors = [(0, 255, 0)] # Green
run_test_case(p, "Test 2: Fast pulsing (5-51 brightness)", 8000) run_test_case(p, "Test 2: Fast pulsing (100-255 brightness)", 8000)
# Test Case 3: Medium breathing # Test Case 3: Medium breathing
p.n1 = 15 # Min brightness 15 p.n1 = 80 # Min brightness 80
p.brightness = 45 # Max brightness 45 p.brightness = 255 # Max brightness 255
p.delay = 1500 # 1.5 second cycle p.delay = 1500 # 1.5 second cycle
p.colors = [(0, 0, 255)] # Blue p.colors = [(0, 0, 255)] # Blue
run_test_case(p, "Test 3: Medium breathing (15-45 brightness)", 10000) run_test_case(p, "Test 3: Medium breathing (80-255 brightness)", 10000)
# Test Case 4: Very slow breathing # Test Case 4: Very slow breathing
p.n1 = 20 # Min brightness 20 p.n1 = 150 # Min brightness 150
p.brightness = 30 # Max brightness 30 p.brightness = 255 # Max brightness 255
p.delay = 5000 # 5 second cycle p.delay = 5000 # 5 second cycle
p.colors = [(255, 255, 0)] # Yellow p.colors = [(255, 255, 0)] # Yellow
run_test_case(p, "Test 4: Very slow breathing (20-30 brightness)", 15000) run_test_case(p, "Test 4: Very slow breathing (150-255 brightness)", 15000)
# Test Case 5: Very fast pulsing # Test Case 5: Very fast pulsing
p.n1 = 0 # Min brightness 0 p.n1 = 50 # Min brightness 50
p.brightness = 51 # Max brightness 51 p.brightness = 255 # Max brightness 255
p.delay = 200 # 0.2 second cycle p.delay = 200 # 0.2 second cycle
p.colors = [(255, 0, 255)] # Magenta p.colors = [(255, 0, 255)] # Magenta
run_test_case(p, "Test 5: Very fast pulsing (0-51 brightness)", 6000) run_test_case(p, "Test 5: Very fast pulsing (50-255 brightness)", 6000)
# Test Case 6: Low range, slow cycle # Test Case 6: Low range, slow cycle
p.n1 = 25 # Min brightness 25 p.n1 = 200 # Min brightness 200
p.brightness = 35 # Max brightness 35 p.brightness = 255 # Max brightness 255
p.delay = 4000 # 4 second cycle p.delay = 4000 # 4 second cycle
p.colors = [(0, 255, 255)] # Cyan p.colors = [(0, 255, 255)] # Cyan
run_test_case(p, "Test 6: Low range, slow cycle (25-35 brightness)", 12000) run_test_case(p, "Test 6: Low range, slow cycle (200-255 brightness)", 12000)
# Test Case 7: High range, medium cycle # Test Case 7: High range, medium cycle
p.n1 = 5 # Min brightness 5 p.n1 = 100 # Min brightness 100
p.brightness = 51 # Max brightness 51 p.brightness = 255 # Max brightness 255
p.delay = 1000 # 1 second cycle p.delay = 1000 # 1 second cycle
p.colors = [(255, 128, 0)] # Orange p.colors = [(255, 128, 0)] # Orange
run_test_case(p, "Test 7: High range, medium cycle (5-51 brightness)", 8000) run_test_case(p, "Test 7: High range, medium cycle (100-255 brightness)", 8000)
# Test Case 8: Ultra fast strobe # Test Case 8: Ultra fast strobe
p.n1 = 0 # Min brightness 0 p.n1 = 100 # Min brightness 100
p.brightness = 51 # Max brightness 51 p.brightness = 255 # Max brightness 255
p.delay = 100 # 0.1 second cycle p.delay = 100 # 0.1 second cycle
p.colors = [(128, 0, 255)] # Purple p.colors = [(128, 0, 255)] # Purple
run_test_case(p, "Test 8: Ultra fast strobe (0-51 brightness)", 4000) run_test_case(p, "Test 8: Ultra fast strobe (100-255 brightness)", 4000)
print("\n=== All tests completed ===") print("\n=== All tests completed ===")