Compare commits
11 Commits
059bd41a59
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 07cd592566 | |||
| 2228b23a53 | |||
| 1f33fff665 | |||
| e91b291dc6 | |||
| 2db9b3464a | |||
| 8345b31caf | |||
| dce2954114 | |||
| 15626431ce | |||
| b13ec01561 | |||
| 83cb34d6a8 | |||
| c9449a6d86 |
165
edit_settings.py
Normal file
165
edit_settings.py
Normal file
@@ -0,0 +1,165 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Settings editor - copy from device, edit locally, upload back
|
||||
Run with: python3 edit_settings.py
|
||||
"""
|
||||
|
||||
import json
|
||||
import subprocess
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
def copy_settings_from_device():
|
||||
"""Copy settings.json from the MicroPython device"""
|
||||
print("Copying settings from device...")
|
||||
try:
|
||||
# Use mpremote to copy settings.json to local temp file
|
||||
result = subprocess.run(['mpremote', 'cp', ':/settings.json', 'settings.json'],
|
||||
capture_output=True, text=True)
|
||||
if result.returncode == 0:
|
||||
print("Settings copied successfully")
|
||||
return True
|
||||
else:
|
||||
print(f"Failed to copy settings: {result.stderr}")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"Error copying settings: {e}")
|
||||
return False
|
||||
|
||||
def load_local_settings():
|
||||
"""Load settings from local file"""
|
||||
try:
|
||||
with open('settings.json', 'r') as f:
|
||||
return json.load(f)
|
||||
except FileNotFoundError:
|
||||
print("No local settings file found")
|
||||
return {}
|
||||
except Exception as e:
|
||||
print(f"Error loading settings: {e}")
|
||||
return {}
|
||||
|
||||
def save_local_settings(settings):
|
||||
"""Save settings to local file"""
|
||||
try:
|
||||
with open('settings.json', 'w') as f:
|
||||
json.dump(settings, f, indent=2)
|
||||
print("Settings saved locally")
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"Error saving settings: {e}")
|
||||
return False
|
||||
|
||||
def upload_settings_to_device():
|
||||
"""Upload settings.json to the MicroPython device"""
|
||||
print("Uploading settings to device...")
|
||||
try:
|
||||
result = subprocess.run(['mpremote', 'cp', 'settings.json', ':/settings.json'],
|
||||
capture_output=True, text=True)
|
||||
if result.returncode == 0:
|
||||
print("Settings uploaded successfully")
|
||||
return True
|
||||
else:
|
||||
print(f"Failed to upload settings: {result.stderr}")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"Error uploading settings: {e}")
|
||||
return False
|
||||
|
||||
def edit_settings_interactive(settings):
|
||||
"""Interactive settings editor"""
|
||||
print("\nLED Bar Settings Editor")
|
||||
print("=======================")
|
||||
|
||||
# Display current settings
|
||||
current_pin = settings.get("led_pin", 10)
|
||||
current_leds = settings.get("num_leds", 119)
|
||||
current_name = settings.get("name", "104")
|
||||
current_color_order = settings.get("color_order", "rgb")
|
||||
|
||||
print(f"\nCurrent settings:")
|
||||
print(f" 1. LED Pin: {current_pin}")
|
||||
print(f" 2. Number of LEDs: {current_leds}")
|
||||
print(f" 3. Device Name: {current_name}")
|
||||
print(f" 4. Color Order: {current_color_order}")
|
||||
|
||||
print(f"\nEnter new values (press Enter to keep current):")
|
||||
|
||||
# LED Pin
|
||||
new_pin = input(f"LED Pin [{current_pin}]: ").strip()
|
||||
if new_pin:
|
||||
try:
|
||||
settings["led_pin"] = int(new_pin)
|
||||
except ValueError:
|
||||
print("Invalid pin number, keeping current value.")
|
||||
|
||||
# Number of LEDs
|
||||
new_leds = input(f"Number of LEDs [{current_leds}]: ").strip()
|
||||
if new_leds:
|
||||
try:
|
||||
settings["num_leds"] = int(new_leds)
|
||||
except ValueError:
|
||||
print("Invalid LED count, keeping current value.")
|
||||
|
||||
# Device Name
|
||||
new_name = input(f"Device Name [{current_name}]: ").strip()
|
||||
if new_name:
|
||||
settings["name"] = new_name
|
||||
|
||||
# Color Order
|
||||
print(f"Color Order options: rgb, rbg")
|
||||
new_color_order = input(f"Color Order [{current_color_order}]: ").strip().lower()
|
||||
if new_color_order in ['rgb', 'rbg']:
|
||||
settings["color_order"] = new_color_order
|
||||
elif new_color_order:
|
||||
print("Invalid color order, keeping current value.")
|
||||
|
||||
return settings
|
||||
|
||||
def main():
|
||||
print("LED Bar Settings Editor")
|
||||
print("=======================")
|
||||
|
||||
# Step 1: Copy settings from device
|
||||
if not copy_settings_from_device():
|
||||
print("Creating default settings...")
|
||||
default_settings = {
|
||||
"led_pin": 10,
|
||||
"num_leds": 119,
|
||||
"color_order": "rgb",
|
||||
"name": "104"
|
||||
}
|
||||
save_local_settings(default_settings)
|
||||
|
||||
# Step 2: Load and edit settings
|
||||
settings = load_local_settings()
|
||||
if not settings:
|
||||
print("No settings to edit")
|
||||
return
|
||||
|
||||
# Step 3: Interactive editing
|
||||
edited_settings = edit_settings_interactive(settings.copy())
|
||||
|
||||
# Step 4: Save locally
|
||||
if edited_settings != settings:
|
||||
save_local_settings(edited_settings)
|
||||
|
||||
# Step 5: Upload to device
|
||||
upload_choice = input("\nUpload settings to device? (y/n): ").strip().lower()
|
||||
if upload_choice in ['y', 'yes']:
|
||||
if upload_settings_to_device():
|
||||
print("\nSettings updated successfully!")
|
||||
print("Restart the device to apply changes.")
|
||||
else:
|
||||
print("\nFailed to upload settings.")
|
||||
else:
|
||||
print("\nSettings saved locally but not uploaded.")
|
||||
else:
|
||||
print("\nNo changes made.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -117,8 +117,11 @@ class Patterns(PatternBase): # Inherit from PatternBase
|
||||
pos -= 170
|
||||
return (0, pos * 3, 255 - pos * 3)
|
||||
|
||||
# Rainbow travels along the length - each LED position gets a different color
|
||||
for i in range(self.num_leds):
|
||||
rc_index = (i * 256 // self.num_leds) + self.pattern_step
|
||||
# Map LED position along strip to rainbow color
|
||||
# Full 256 color range distributed along the strip length
|
||||
rc_index = ((i * 256 // self.num_leds) + self.pattern_step) % 256
|
||||
self.n[i] = self.apply_brightness(wheel(rc_index & 255))
|
||||
self.n.write()
|
||||
self.pattern_step = (self.pattern_step + 1) % 256
|
||||
|
||||
323
src/patterns.py
323
src/patterns.py
@@ -1,6 +1,7 @@
|
||||
|
||||
import utime
|
||||
import random
|
||||
import math
|
||||
from patterns_base import PatternBase # Import PatternBase
|
||||
import _thread
|
||||
from machine import WDT
|
||||
@@ -23,6 +24,11 @@ class Patterns(PatternBase): # Inherit from PatternBase
|
||||
"o": self.off,
|
||||
"on": self.on,
|
||||
"bl": self.blink,
|
||||
"cl": self.circle_loading,
|
||||
"sb": self.sine_brightness,
|
||||
"rb": self.rainbow,
|
||||
"fl": self.flicker,
|
||||
"nc": self.n_chase,
|
||||
}
|
||||
self.step = 0
|
||||
self.run = True
|
||||
@@ -64,6 +70,233 @@ class Patterns(PatternBase): # Inherit from PatternBase
|
||||
self.run = False
|
||||
self.running = False
|
||||
|
||||
def circle_loading(self):
|
||||
"""Circle loading pattern - grows to n2, then tail moves forward at n3 until min length n4"""
|
||||
self.run = True
|
||||
head = 0
|
||||
tail = 0
|
||||
|
||||
# Calculate timing
|
||||
head_rate = max(1, int(self.n1)) # n1 = head moves per second
|
||||
tail_rate = max(1, int(self.n3)) # n3 = tail moves per second
|
||||
max_length = max(1, int(self.n2)) # n2 = max length
|
||||
min_length = max(0, int(self.n4)) # n4 = min length
|
||||
|
||||
head_delay = 1000 // head_rate # ms between head movements
|
||||
tail_delay = 1000 // tail_rate # ms between tail movements
|
||||
|
||||
last_head_move = utime.ticks_ms()
|
||||
last_tail_move = utime.ticks_ms()
|
||||
|
||||
phase = "growing" # "growing", "shrinking", or "off"
|
||||
|
||||
while self.run:
|
||||
self.wdt.feed()
|
||||
current_time = utime.ticks_ms()
|
||||
|
||||
# Clear all LEDs
|
||||
self.n.fill((0, 0, 0))
|
||||
|
||||
# Calculate segment length
|
||||
segment_length = (head - tail) % self.num_leds
|
||||
if segment_length == 0 and head != tail:
|
||||
segment_length = self.num_leds
|
||||
|
||||
# Draw segment from tail to head
|
||||
color = self.apply_brightness(self.colors[0])
|
||||
for i in range(segment_length + 1):
|
||||
led_pos = (tail + i) % self.num_leds
|
||||
self.n[led_pos] = color
|
||||
|
||||
# Move head continuously at n1 LEDs per second
|
||||
if utime.ticks_diff(current_time, last_head_move) >= head_delay:
|
||||
head = (head + 1) % self.num_leds
|
||||
last_head_move = current_time
|
||||
|
||||
# Tail behavior based on phase
|
||||
if phase == "growing":
|
||||
# Growing phase: tail stays at 0 until max length reached
|
||||
if segment_length >= max_length:
|
||||
phase = "shrinking"
|
||||
elif phase == "shrinking":
|
||||
# Shrinking phase: move tail forward at n3 LEDs per second
|
||||
if utime.ticks_diff(current_time, last_tail_move) >= tail_delay:
|
||||
tail = (tail + 1) % self.num_leds
|
||||
last_tail_move = current_time
|
||||
|
||||
# Check if we've reached min length
|
||||
current_length = (head - tail) % self.num_leds
|
||||
if current_length == 0 and head != tail:
|
||||
current_length = self.num_leds
|
||||
|
||||
# For min_length = 0, we need at least 1 LED (the head)
|
||||
if min_length == 0 and current_length <= 1:
|
||||
phase = "off" # All LEDs off for 1 step
|
||||
elif min_length > 0 and current_length <= min_length:
|
||||
phase = "growing" # Cycle repeats
|
||||
else: # phase == "off"
|
||||
# Off phase: all LEDs off for 1 step, then restart
|
||||
phase = "growing"
|
||||
|
||||
self.n.write()
|
||||
|
||||
self.run = False
|
||||
self.running = False
|
||||
|
||||
def sine_brightness(self):
|
||||
"""Sine wave brightness pattern - n1=min brightness, brightness=max brightness, wavelength=delay"""
|
||||
self.run = True
|
||||
|
||||
# Calculate sine wave parameters
|
||||
min_brightness = max(0, int(self.n1)) # n1 = minimum brightness
|
||||
max_brightness = self.brightness # brightness = maximum brightness
|
||||
amplitude = max_brightness - min_brightness # Range between min and max
|
||||
wavelength = max(1, self.delay) # Wavelength = delay in ms
|
||||
|
||||
# Convert wavelength to frequency (cycles per second)
|
||||
frequency = 1000.0 / wavelength # Hz
|
||||
|
||||
start_time = utime.ticks_ms()
|
||||
|
||||
while self.run:
|
||||
self.wdt.feed()
|
||||
current_time = utime.ticks_ms()
|
||||
|
||||
# Calculate time elapsed in seconds
|
||||
elapsed_ms = utime.ticks_diff(current_time, start_time)
|
||||
elapsed_seconds = elapsed_ms / 1000.0
|
||||
|
||||
# Calculate sine wave value (-1 to 1)
|
||||
sine_value = math.sin(2 * math.pi * frequency * elapsed_seconds)
|
||||
|
||||
# Convert to brightness (min_brightness to max_brightness)
|
||||
current_brightness = int(min_brightness + (sine_value + 1) * amplitude / 2)
|
||||
current_brightness = max(0, min(255, current_brightness))
|
||||
|
||||
# Apply brightness to all LEDs
|
||||
color = self.apply_brightness(self.colors[0])
|
||||
# Override brightness with calculated value
|
||||
adjusted_color = (
|
||||
int(color[0] * current_brightness / 255),
|
||||
int(color[1] * current_brightness / 255),
|
||||
int(color[2] * current_brightness / 255)
|
||||
)
|
||||
|
||||
self.fill(adjusted_color)
|
||||
self.n.write()
|
||||
|
||||
self.run = 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))
|
||||
|
||||
# Rainbow travels along the length - distribute colors along the strip
|
||||
for i in range(self.num_leds):
|
||||
# Calculate hue based on LED position along the strip
|
||||
# Distribute full 360 degrees across the strip, repeat num_nodes times
|
||||
# Position along the strip (0.0 to 1.0)
|
||||
position = i / self.num_leds
|
||||
# Hue cycles based on position and number of nodes
|
||||
hue = int((position * 360 * num_nodes + 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 flicker(self):
|
||||
# current_time = utime.ticks_ms()
|
||||
# base_color = self.colors[0]
|
||||
@@ -98,34 +331,74 @@ class Patterns(PatternBase): # Inherit from PatternBase
|
||||
# self.last_update = current_time
|
||||
# return self.delay
|
||||
|
||||
# def n_chase(self):
|
||||
# """
|
||||
# A theater chase pattern using n1 for on-width and n2 for off-width.
|
||||
# """
|
||||
# current_time = utime.ticks_ms()
|
||||
# step_rate = max(1, int(self.n3))
|
||||
# segment_length = self.n1 + self.n2
|
||||
# if segment_length == 0: # Avoid division by zero
|
||||
# self.fill((0,0,0))
|
||||
# self.n.write()
|
||||
# self.last_update = current_time
|
||||
# return self.delay
|
||||
def n_chase(self):
|
||||
"""Chase pattern - n1 LEDs on, n2 LEDs off, bidirectional movement"""
|
||||
self.run = True
|
||||
|
||||
# # Use controller's step for synchronization, but scale it for chasing
|
||||
# chase_step = (self.step * step_rate) % self.num_leds
|
||||
# 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
|
||||
|
||||
# n3 = forward steps per move, n4 = backward steps per move
|
||||
forward_steps = max(1, abs(int(self.n3)))
|
||||
backward_steps = max(1, abs(int(self.n4)))
|
||||
|
||||
# Calculate timing from delay
|
||||
step_delay = max(10, int(self.delay)) # At least 10ms
|
||||
|
||||
position = 0 # Current position of the chase head
|
||||
phase = "forward" # "forward" or "backward"
|
||||
steps_remaining = forward_steps
|
||||
total_steps = 0 # Track total steps for wrapping
|
||||
|
||||
last_update = utime.ticks_ms()
|
||||
color = self.apply_brightness(self.colors[0])
|
||||
|
||||
while self.run:
|
||||
self.wdt.feed()
|
||||
current_time = utime.ticks_ms()
|
||||
|
||||
# for i in range(self.num_leds):
|
||||
# # Calculate position relative to the chase head
|
||||
# pos_from_head = (i - chase_step) % self.num_leds
|
||||
# if pos_from_head < self.n1:
|
||||
# self.n[i] = self.apply_brightness(self.colors[0])
|
||||
# else:
|
||||
# self.n[i] = (0, 0, 0)
|
||||
# self.n.write()
|
||||
# Check if it's time to move
|
||||
if utime.ticks_diff(current_time, last_update) >= step_delay:
|
||||
# Move position based on current phase
|
||||
if phase == "forward":
|
||||
total_steps = (total_steps + 1) % (self.num_leds * segment_length)
|
||||
position = total_steps % segment_length
|
||||
steps_remaining -= 1
|
||||
if steps_remaining == 0:
|
||||
phase = "backward"
|
||||
steps_remaining = backward_steps
|
||||
else: # backward
|
||||
total_steps = (total_steps - 1) % (self.num_leds * segment_length)
|
||||
position = total_steps % segment_length
|
||||
steps_remaining -= 1
|
||||
if steps_remaining == 0:
|
||||
phase = "forward"
|
||||
steps_remaining = forward_steps
|
||||
|
||||
# Clear all LEDs
|
||||
self.n.fill((0, 0, 0))
|
||||
|
||||
# Draw the chase pattern - repeating segments across all LEDs
|
||||
# Position determines where to start drawing on the strip
|
||||
for i in range(self.num_leds):
|
||||
# Create repeating pattern of on_width on, off_width off
|
||||
pos_in_segment = ((i + position) % segment_length)
|
||||
if pos_in_segment < on_width:
|
||||
self.n[i] = color
|
||||
|
||||
self.n.write()
|
||||
last_update = current_time
|
||||
|
||||
utime.sleep_ms(1)
|
||||
|
||||
# # Don't update internal step - use controller's step for sync
|
||||
# self.last_update = current_time
|
||||
# return self.delay
|
||||
self.run = False
|
||||
self.running = False
|
||||
|
||||
|
||||
# def alternating(self):
|
||||
# # Use n1 as ON width and n2 as OFF width
|
||||
|
||||
@@ -6,17 +6,32 @@ Run with: mpremote run test/blink.py
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
def test_blink():
|
||||
print("Testing blink pattern...")
|
||||
|
||||
# Initialize patterns with LED pin 10 and 59 LEDs at 20% brightness
|
||||
p = patterns.Patterns(pin=10, num_leds=59, brightness=51, delay=500)
|
||||
# Initialize watchdog timer
|
||||
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
|
||||
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"Delay: {p.delay}ms")
|
||||
print(f"Color: {p.colors[0]}")
|
||||
@@ -25,8 +40,11 @@ def test_blink():
|
||||
print("Starting blink pattern for 5 seconds...")
|
||||
p.select("bl")
|
||||
|
||||
# Let it run for 5 seconds
|
||||
utime.sleep(5)
|
||||
# Let it run for 5 seconds with WDT feeding
|
||||
start_time = utime.ticks_ms()
|
||||
while utime.ticks_diff(utime.ticks_ms(), start_time) < 5000:
|
||||
wdt.feed()
|
||||
utime.sleep_ms(100)
|
||||
|
||||
# Stop the pattern
|
||||
p.run = False
|
||||
|
||||
58
test/circle/1.py
Normal file
58
test/circle/1.py
Normal 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
58
test/circle/2.py
Normal 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
58
test/circle/3.py
Normal 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
58
test/circle/4.py
Normal 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
58
test/circle/5.py
Normal 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
58
test/circle/6.py
Normal 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
58
test/circle/7.py
Normal 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
58
test/circle/8.py
Normal 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")
|
||||
|
||||
128
test/circle_loading.py
Normal file
128
test/circle_loading.py
Normal file
@@ -0,0 +1,128 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script for circle loading pattern with multiple test cases
|
||||
Run with: mpremote run test/circle_loading.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} head/sec, n2={p.n2} max length, n3={p.n3} tail/sec, n4={p.n4} min length")
|
||||
print(f"Color: {p.colors[0]}")
|
||||
print(f"Running for {duration_ms//1000} seconds...")
|
||||
|
||||
# Initialize watchdog timer
|
||||
wdt = WDT(timeout=10000)
|
||||
wdt.feed()
|
||||
|
||||
# Start pattern
|
||||
p.select("cl")
|
||||
|
||||
# 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_circle_loading():
|
||||
print("Testing circle loading 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,
|
||||
delay=2000 # Base cycle time
|
||||
)
|
||||
|
||||
print(f"LED Pin: {settings['led_pin']}")
|
||||
print(f"LEDs: {settings['num_leds']}")
|
||||
print(f"Brightness: {p.brightness}")
|
||||
|
||||
# Test Case 1: Your specified parameters
|
||||
p.n1 = 50
|
||||
p.n2 = 100
|
||||
p.n3 = 200
|
||||
p.n4 = 0
|
||||
p.colors = [(255, 0, 0)] # Red
|
||||
run_test_case(p, "Test 1: n1=50, n2=100, n3=200, n4=0", 15000)
|
||||
|
||||
# Test Case 2: Slow head, fast tail
|
||||
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
|
||||
run_test_case(p, "Test 2: n1=10, n2=30, n3=20, n4=5", 10000)
|
||||
|
||||
# Test Case 3: Equal head and tail speed
|
||||
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
|
||||
run_test_case(p, "Test 3: n1=15, n2=25, n3=15, n4=3", 8000)
|
||||
|
||||
# Test Case 4: Very fast head, slow tail
|
||||
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
|
||||
run_test_case(p, "Test 4: n1=30, n2=40, n3=5, n4=8", 12000)
|
||||
|
||||
# Test Case 5: Long segment, fast cycle
|
||||
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
|
||||
run_test_case(p, "Test 5: n1=25, n2=60, n3=30, n4=2", 10000)
|
||||
|
||||
# Test Case 6: Very slow head, very fast tail
|
||||
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
|
||||
run_test_case(p, "Test 6: n1=5, n2=20, n3=40, n4=1", 8000)
|
||||
|
||||
# Test Case 7: Medium speeds, short segment
|
||||
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
|
||||
run_test_case(p, "Test 7: n1=12, n2=15, n3=18, n4=4", 6000)
|
||||
|
||||
# Test Case 8: Ultra fast everything
|
||||
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
|
||||
run_test_case(p, "Test 8: n1=100, n2=50, n3=150, n4=10", 5000)
|
||||
|
||||
print("\n=== All tests completed ===")
|
||||
|
||||
# Turn off LEDs
|
||||
p.off()
|
||||
print("LEDs turned off")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_circle_loading()
|
||||
56
test/flicker/1.py
Normal file
56
test/flicker/1.py
Normal 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
56
test/flicker/2.py
Normal 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
56
test/flicker/3.py
Normal 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
56
test/flicker/4.py
Normal 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
56
test/flicker/5.py
Normal 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
56
test/flicker/6.py
Normal 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
56
test/flicker/7.py
Normal 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
56
test/flicker/8.py
Normal 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")
|
||||
|
||||
@@ -75,7 +75,7 @@ async def run_suite(uri: str):
|
||||
i,
|
||||
delay=cfg.get("delay"),
|
||||
colors=cfg.get("colors"),
|
||||
brightness=cfg.get("brightness", 127),
|
||||
brightness=cfg.get("brightness", 255),
|
||||
num_leds=cfg.get("num_leds"),
|
||||
n1=cfg.get("n1"),
|
||||
n2=cfg.get("n2"),
|
||||
|
||||
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")
|
||||
|
||||
62
test/n_chase/9.py
Normal file
62
test/n_chase/9.py
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
N-chase test 9: Cyan, on=20, off=20, delay=200ms
|
||||
Runs forever
|
||||
Run with: mpremote run test/n_chase/9.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting N-Chase Test 9: Cyan, on=20, off=20, 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 = 20 # On width 20
|
||||
p.n2 = 20 # Off width 20
|
||||
p.n3 = 20 # Reserved for future use
|
||||
p.n4 = -5 # Reserved for future use
|
||||
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"n3: {p.n3}")
|
||||
print(f"n4: {p.n4}")
|
||||
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")
|
||||
|
||||
56
test/rainbow/1.py
Normal file
56
test/rainbow/1.py
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Rainbow test 1: Single node (full spectrum), 3 second cycle, full brightness
|
||||
Runs forever
|
||||
Run with: mpremote run test/rainbow/1.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting Rainbow Test 1: Single node (full spectrum), 3 second cycle")
|
||||
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=3000 # 3 second cycle
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 1 # 1 node (full spectrum)
|
||||
p.delay = 3000 # 3 second cycle
|
||||
p.brightness = 255 # Full brightness
|
||||
|
||||
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"Nodes: {p.n1}")
|
||||
|
||||
# Initialize watchdog timer
|
||||
wdt = WDT(timeout=10000)
|
||||
wdt.feed()
|
||||
|
||||
# Start pattern
|
||||
p.select("rb")
|
||||
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/rainbow/2.py
Normal file
56
test/rainbow/2.py
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Rainbow test 2: Two nodes, 2 second cycle, full brightness
|
||||
Runs forever
|
||||
Run with: mpremote run test/rainbow/2.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting Rainbow Test 2: Two nodes, 2 second cycle")
|
||||
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 # 2 second cycle
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 2 # 2 nodes
|
||||
p.delay = 2000 # 2 second cycle
|
||||
p.brightness = 255 # Full brightness
|
||||
|
||||
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"Nodes: {p.n1}")
|
||||
|
||||
# Initialize watchdog timer
|
||||
wdt = WDT(timeout=10000)
|
||||
wdt.feed()
|
||||
|
||||
# Start pattern
|
||||
p.select("rb")
|
||||
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/rainbow/3.py
Normal file
56
test/rainbow/3.py
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Rainbow test 3: Three nodes (RGB), 1.5 second cycle, full brightness
|
||||
Runs forever
|
||||
Run with: mpremote run test/rainbow/3.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting Rainbow Test 3: Three nodes (RGB), 1.5 second cycle")
|
||||
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=1500 # 1.5 second cycle
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 3 # 3 nodes
|
||||
p.delay = 1500 # 1.5 second cycle
|
||||
p.brightness = 255 # Full brightness
|
||||
|
||||
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"Nodes: {p.n1}")
|
||||
|
||||
# Initialize watchdog timer
|
||||
wdt = WDT(timeout=10000)
|
||||
wdt.feed()
|
||||
|
||||
# Start pattern
|
||||
p.select("rb")
|
||||
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/rainbow/4.py
Normal file
56
test/rainbow/4.py
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Rainbow test 4: Four nodes (RYGB), 1 second cycle, full brightness
|
||||
Runs forever
|
||||
Run with: mpremote run test/rainbow/4.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting Rainbow Test 4: Four nodes (RYGB), 1 second cycle")
|
||||
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=1000 # 1 second cycle
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 4 # 4 nodes
|
||||
p.delay = 1000 # 1 second cycle
|
||||
p.brightness = 255 # Full brightness
|
||||
|
||||
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"Nodes: {p.n1}")
|
||||
|
||||
# Initialize watchdog timer
|
||||
wdt = WDT(timeout=10000)
|
||||
wdt.feed()
|
||||
|
||||
# Start pattern
|
||||
p.select("rb")
|
||||
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/rainbow/5.py
Normal file
56
test/rainbow/5.py
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Rainbow test 5: Six nodes (ROYGBP), 0.8 second cycle, full brightness
|
||||
Runs forever
|
||||
Run with: mpremote run test/rainbow/5.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting Rainbow Test 5: Six nodes (ROYGBP), 0.8 second cycle")
|
||||
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=800 # 0.8 second cycle
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 6 # 6 nodes
|
||||
p.delay = 800 # 0.8 second cycle
|
||||
p.brightness = 255 # Full brightness
|
||||
|
||||
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"Nodes: {p.n1}")
|
||||
|
||||
# Initialize watchdog timer
|
||||
wdt = WDT(timeout=10000)
|
||||
wdt.feed()
|
||||
|
||||
# Start pattern
|
||||
p.select("rb")
|
||||
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/rainbow/6.py
Normal file
56
test/rainbow/6.py
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Rainbow test 6: Eight nodes, 0.6 second cycle, full brightness
|
||||
Runs forever
|
||||
Run with: mpremote run test/rainbow/6.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting Rainbow Test 6: Eight nodes, 0.6 second cycle")
|
||||
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=600 # 0.6 second cycle
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 8 # 8 nodes
|
||||
p.delay = 600 # 0.6 second cycle
|
||||
p.brightness = 255 # Full brightness
|
||||
|
||||
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"Nodes: {p.n1}")
|
||||
|
||||
# Initialize watchdog timer
|
||||
wdt = WDT(timeout=10000)
|
||||
wdt.feed()
|
||||
|
||||
# Start pattern
|
||||
p.select("rb")
|
||||
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/rainbow/7.py
Normal file
56
test/rainbow/7.py
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Rainbow test 7: Twelve nodes (fine gradation), 0.4 second cycle, full brightness
|
||||
Runs forever
|
||||
Run with: mpremote run test/rainbow/7.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting Rainbow Test 7: Twelve nodes (fine gradation), 0.4 second cycle")
|
||||
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=400 # 0.4 second cycle
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 12 # 12 nodes
|
||||
p.delay = 400 # 0.4 second cycle
|
||||
p.brightness = 255 # Full brightness
|
||||
|
||||
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"Nodes: {p.n1}")
|
||||
|
||||
# Initialize watchdog timer
|
||||
wdt = WDT(timeout=10000)
|
||||
wdt.feed()
|
||||
|
||||
# Start pattern
|
||||
p.select("rb")
|
||||
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/rainbow/8.py
Normal file
56
test/rainbow/8.py
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Rainbow test 8: Many nodes (20), slow cycle (2 seconds), full brightness
|
||||
Runs forever
|
||||
Run with: mpremote run test/rainbow/8.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting Rainbow Test 8: Many nodes (20), slow cycle (2 seconds)")
|
||||
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 # 2 second cycle
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 20 # 20 nodes
|
||||
p.delay = 2000 # 2 second cycle
|
||||
p.brightness = 255 # Full brightness
|
||||
|
||||
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"Nodes: {p.n1}")
|
||||
|
||||
# Initialize watchdog timer
|
||||
wdt = WDT(timeout=10000)
|
||||
wdt.feed()
|
||||
|
||||
# Start pattern
|
||||
p.select("rb")
|
||||
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/rainbow/9.py
Normal file
56
test/rainbow/9.py
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Rainbow test 9: Five nodes, 1 second cycle, full brightness
|
||||
Runs forever
|
||||
Run with: mpremote run test/rainbow/9.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
print("Starting Rainbow Test 9: Five nodes, 1 second cycle")
|
||||
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=1000 # 1 second cycle
|
||||
)
|
||||
|
||||
# Configure test parameters
|
||||
p.n1 = 5 # 5 nodes
|
||||
p.delay = 1000 # 1 second cycle
|
||||
p.brightness = 255 # Full brightness
|
||||
|
||||
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"Nodes: {p.n1}")
|
||||
|
||||
# Initialize watchdog timer
|
||||
wdt = WDT(timeout=10000)
|
||||
wdt.feed()
|
||||
|
||||
# Start pattern
|
||||
p.select("rb")
|
||||
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")
|
||||
|
||||
100
test/rainbow/main.py
Normal file
100
test/rainbow/main.py
Normal file
@@ -0,0 +1,100 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Rainbow test suite - runs all tests in sequence forever
|
||||
Run with: mpremote run test/rainbow/main.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
def run_test_case(p, test_name, n1, delay, brightness, duration_ms=6000):
|
||||
"""Run a test case for specified duration"""
|
||||
print(f"\n--- {test_name} ---")
|
||||
print(f"Parameters: n1={n1} nodes, delay={delay}ms cycle time, brightness={brightness}")
|
||||
|
||||
# Configure parameters
|
||||
p.n1 = n1
|
||||
p.delay = delay
|
||||
p.brightness = brightness
|
||||
|
||||
# Restart the pattern with new parameters
|
||||
p.run = False
|
||||
while p.running:
|
||||
utime.sleep_ms(1)
|
||||
|
||||
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_suite():
|
||||
"""Run all rainbow tests continuously"""
|
||||
print("Starting rainbow test suite...")
|
||||
print("Runs all tests in sequence, then repeats")
|
||||
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=1000
|
||||
)
|
||||
|
||||
print(f"LED Pin: {settings['led_pin']}")
|
||||
print(f"LEDs: {settings['num_leds']}")
|
||||
print(f"Base Brightness: {p.brightness}")
|
||||
|
||||
# Initialize watchdog timer
|
||||
global wdt
|
||||
wdt = WDT(timeout=10000)
|
||||
wdt.feed()
|
||||
|
||||
# Test configurations
|
||||
tests = [
|
||||
("Test 1: Single node (full spectrum)", 1, 3000, 255, 12000),
|
||||
("Test 2: Two nodes", 2, 2000, 255, 10000),
|
||||
("Test 3: Three nodes (RGB)", 3, 1500, 255, 9000),
|
||||
("Test 4: Four nodes (RYGB)", 4, 1000, 255, 8000),
|
||||
("Test 5: Six nodes (ROYGBP)", 6, 800, 255, 8000),
|
||||
("Test 6: Eight nodes", 8, 600, 255, 6000),
|
||||
("Test 7: Twelve nodes (fine gradation)", 12, 400, 255, 6000),
|
||||
("Test 8: Many nodes (20), slow cycle", 20, 2000, 255, 10000),
|
||||
("Test 9: Five nodes", 5, 1000, 255, 6000),
|
||||
]
|
||||
|
||||
cycle = 0
|
||||
try:
|
||||
while True:
|
||||
cycle += 1
|
||||
print(f"\n\n========== Starting Cycle {cycle} ==========")
|
||||
|
||||
for test_name, n1, delay, brightness, duration in tests:
|
||||
run_test_case(p, test_name, n1, delay, brightness, duration)
|
||||
|
||||
print("\n========== Cycle completed ==========\n")
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("\n\nStopping test suite...")
|
||||
p.run = False
|
||||
p.off()
|
||||
print("LEDs turned off")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_rainbow_suite()
|
||||
|
||||
160
test/random_test.py
Normal file
160
test/random_test.py
Normal file
@@ -0,0 +1,160 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Random test - randomly selects and runs test patterns for 2-10 minutes each
|
||||
Run with: mpremote run test/random_test.py
|
||||
"""
|
||||
|
||||
import patterns
|
||||
import utime
|
||||
import random
|
||||
import math
|
||||
from settings import Settings
|
||||
from machine import WDT
|
||||
|
||||
def run_pattern(p, pattern_name, config, duration_ms):
|
||||
"""Run a pattern for specified duration"""
|
||||
print(f"\n{'='*60}")
|
||||
print(f"Starting: {pattern_name}")
|
||||
print(f"Duration: {duration_ms//1000} seconds")
|
||||
|
||||
# Configure parameters
|
||||
if pattern_name == "blink":
|
||||
p.delay = config.get("delay", 500)
|
||||
elif pattern_name == "circle_loading":
|
||||
p.n1 = config.get("n1", 50)
|
||||
p.n2 = config.get("n2", 100)
|
||||
p.n3 = config.get("n3", 200)
|
||||
p.n4 = config.get("n4", 0)
|
||||
p.delay = config.get("delay", 2000)
|
||||
elif pattern_name == "sine_brightness":
|
||||
p.n1 = config.get("n1", 50)
|
||||
p.brightness = config.get("brightness", 255)
|
||||
p.delay = config.get("delay", 1000)
|
||||
elif pattern_name == "rainbow":
|
||||
p.n1 = config.get("n1", 1)
|
||||
p.delay = config.get("delay", 1000)
|
||||
elif pattern_name == "flicker":
|
||||
p.n1 = config.get("n1", 50)
|
||||
p.delay = config.get("delay", 50)
|
||||
elif pattern_name == "n_chase":
|
||||
p.n1 = config.get("n1", 5)
|
||||
p.n2 = config.get("n2", 5)
|
||||
p.n3 = config.get("n3", 1)
|
||||
p.n4 = config.get("n4", 1)
|
||||
p.delay = config.get("delay", 100)
|
||||
|
||||
# Set color if provided
|
||||
if "color" in config:
|
||||
p.colors = [config["color"]]
|
||||
|
||||
# Start pattern
|
||||
p.select(config.get("short_name", "o"))
|
||||
|
||||
# Run for 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
|
||||
while p.running:
|
||||
utime.sleep_ms(1)
|
||||
|
||||
p.off()
|
||||
print(f"Completed: {pattern_name}")
|
||||
utime.sleep_ms(500)
|
||||
|
||||
def random_test():
|
||||
"""Run random test patterns continuously"""
|
||||
print("Starting Random Test Suite")
|
||||
print("Patterns will change every 1-5 minutes")
|
||||
print("Press Ctrl+C to stop")
|
||||
|
||||
# Load settings
|
||||
settings = Settings()
|
||||
|
||||
# Initialize patterns
|
||||
p = patterns.Patterns(
|
||||
pin=settings["led_pin"],
|
||||
num_leds=settings["num_leds"],
|
||||
brightness=255
|
||||
)
|
||||
|
||||
print(f"LED Pin: {settings['led_pin']}")
|
||||
print(f"LEDs: {settings['num_leds']}")
|
||||
|
||||
# Initialize watchdog
|
||||
global wdt
|
||||
wdt = WDT(timeout=10000)
|
||||
wdt.feed()
|
||||
|
||||
# Define all test configurations
|
||||
test_configs = [
|
||||
# Circle loading patterns
|
||||
{"pattern": "circle_loading", "short_name": "cl", "n1": 50, "n2": 100, "n3": 200, "n4": 0, "delay": 2000, "color": (255, 0, 0)},
|
||||
{"pattern": "circle_loading", "short_name": "cl", "n1": 30, "n2": 60, "n3": 100, "n4": 0, "delay": 1500, "color": (0, 255, 0)},
|
||||
{"pattern": "circle_loading", "short_name": "cl", "n1": 75, "n2": 150, "n3": 300, "n4": 10, "delay": 3000, "color": (0, 0, 255)},
|
||||
|
||||
# Sine brightness patterns
|
||||
{"pattern": "sine_brightness", "short_name": "sb", "n1": 50, "brightness": 255, "delay": 1000, "color": (255, 0, 0)},
|
||||
{"pattern": "sine_brightness", "short_name": "sb", "n1": 100, "brightness": 255, "delay": 800, "color": (0, 255, 0)},
|
||||
{"pattern": "sine_brightness", "short_name": "sb", "n1": 0, "brightness": 255, "delay": 1500, "color": (0, 0, 255)},
|
||||
|
||||
# Rainbow patterns
|
||||
{"pattern": "rainbow", "short_name": "rb", "n1": 1, "delay": 3000, "color": None},
|
||||
{"pattern": "rainbow", "short_name": "rb", "n1": 2, "delay": 2000, "color": None},
|
||||
{"pattern": "rainbow", "short_name": "rb", "n1": 3, "delay": 1500, "color": None},
|
||||
{"pattern": "rainbow", "short_name": "rb", "n1": 6, "delay": 1000, "color": None},
|
||||
{"pattern": "rainbow", "short_name": "rb", "n1": 12, "delay": 800, "color": None},
|
||||
|
||||
# Flicker patterns
|
||||
{"pattern": "flicker", "short_name": "fl", "n1": 50, "delay": 50, "color": (255, 0, 0)},
|
||||
{"pattern": "flicker", "short_name": "fl", "n1": 30, "delay": 100, "color": (0, 255, 0)},
|
||||
{"pattern": "flicker", "short_name": "fl", "n1": 100, "delay": 30, "color": (0, 0, 255)},
|
||||
|
||||
# N-chase patterns (mix of forward-only and bidirectional)
|
||||
# Forward-only patterns
|
||||
{"pattern": "n_chase", "short_name": "nc", "n1": 5, "n2": 5, "n3": 5, "n4": 5, "delay": 100, "color": (255, 0, 0)},
|
||||
{"pattern": "n_chase", "short_name": "nc", "n1": 10, "n2": 5, "n3": 10, "n4": 10, "delay": 150, "color": (0, 255, 0)},
|
||||
{"pattern": "n_chase", "short_name": "nc", "n1": 20, "n2": 20, "n3": 20, "n4": 20, "delay": 200, "color": (0, 255, 255)},
|
||||
# Bidirectional patterns
|
||||
{"pattern": "n_chase", "short_name": "nc", "n1": 15, "n2": 10, "n3": 10, "n4": 5, "delay": 180, "color": (255, 255, 0)},
|
||||
{"pattern": "n_chase", "short_name": "nc", "n1": 20, "n2": 20, "n3": 20, "n4": 5, "delay": 200, "color": (255, 0, 255)},
|
||||
{"pattern": "n_chase", "short_name": "nc", "n1": 12, "n2": 8, "n3": 15, "n4": 8, "delay": 160, "color": (255, 128, 128)},
|
||||
|
||||
# N-chase patterns (forward only, large segments)
|
||||
{"pattern": "n_chase", "short_name": "nc", "n1": 30, "n2": 10, "n3": 5, "n4": 5, "delay": 150, "color": (255, 128, 0)},
|
||||
{"pattern": "n_chase", "short_name": "nc", "n1": 40, "n2": 20, "n3": 10, "n4": 10, "delay": 180, "color": (128, 255, 0)},
|
||||
{"pattern": "n_chase", "short_name": "nc", "n1": 50, "n2": 25, "n3": 20, "n4": 20, "delay": 200, "color": (0, 128, 255)},
|
||||
{"pattern": "n_chase", "short_name": "nc", "n1": 60, "n2": 30, "n3": 30, "n4": 30, "delay": 220, "color": (255, 0, 128)},
|
||||
{"pattern": "n_chase", "short_name": "nc", "n1": 80, "n2": 40, "n3": 50, "n4": 50, "delay": 250, "color": (128, 0, 255)},
|
||||
{"pattern": "n_chase", "short_name": "nc", "n1": 100, "n2": 50, "n3": 100, "n4": 100, "delay": 300, "color": (255, 255, 255)},
|
||||
]
|
||||
|
||||
try:
|
||||
cycle = 0
|
||||
while True:
|
||||
cycle += 1
|
||||
print(f"\n\n{'='*60}")
|
||||
print(f"Random Test Cycle {cycle}")
|
||||
print(f"{'='*60}")
|
||||
|
||||
# Randomly select a test configuration
|
||||
config = random.choice(test_configs)
|
||||
|
||||
# Random duration between 1-5 minutes (60,000 - 300,000 ms)
|
||||
duration_ms = random.randint(60000, 300000)
|
||||
|
||||
# Run the selected pattern
|
||||
run_pattern(p, config["pattern"], config, duration_ms)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("\n\nStopping random test suite...")
|
||||
p.run = False
|
||||
p.off()
|
||||
print("LEDs turned off")
|
||||
|
||||
if __name__ == "__main__":
|
||||
random_test()
|
||||
|
||||
120
test/sine_brightness.py
Normal file
120
test/sine_brightness.py
Normal file
@@ -0,0 +1,120 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script for sine brightness pattern
|
||||
Run with: mpremote run test/sine_brightness.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} min brightness, brightness={p.brightness} max brightness, delay={p.delay}ms wavelength")
|
||||
print(f"Color: {p.colors[0]}")
|
||||
print(f"Running for {duration_ms//1000} seconds...")
|
||||
|
||||
# Initialize watchdog timer
|
||||
wdt = WDT(timeout=10000)
|
||||
wdt.feed()
|
||||
|
||||
# Start pattern
|
||||
p.select("sb")
|
||||
|
||||
# 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_sine_brightness():
|
||||
print("Testing sine brightness 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 wavelength
|
||||
)
|
||||
|
||||
print(f"LED Pin: {settings['led_pin']}")
|
||||
print(f"LEDs: {settings['num_leds']}")
|
||||
print(f"Base Brightness: {p.brightness}")
|
||||
|
||||
# Test Case 1: Slow breathing
|
||||
p.n1 = 50 # Min brightness 50
|
||||
p.brightness = 255 # Max brightness 255
|
||||
p.delay = 3000 # 3 second cycle
|
||||
p.colors = [(255, 0, 0)] # Red
|
||||
run_test_case(p, "Test 1: Slow breathing (50-255 brightness)", 12000)
|
||||
|
||||
# Test Case 2: Fast pulsing
|
||||
p.n1 = 100 # Min brightness 100
|
||||
p.brightness = 255 # Max brightness 255
|
||||
p.delay = 500 # 0.5 second cycle
|
||||
p.colors = [(0, 255, 0)] # Green
|
||||
run_test_case(p, "Test 2: Fast pulsing (100-255 brightness)", 8000)
|
||||
|
||||
# Test Case 3: Medium breathing
|
||||
p.n1 = 80 # Min brightness 80
|
||||
p.brightness = 255 # Max brightness 255
|
||||
p.delay = 1500 # 1.5 second cycle
|
||||
p.colors = [(0, 0, 255)] # Blue
|
||||
run_test_case(p, "Test 3: Medium breathing (80-255 brightness)", 10000)
|
||||
|
||||
# Test Case 4: Very slow breathing
|
||||
p.n1 = 150 # Min brightness 150
|
||||
p.brightness = 255 # Max brightness 255
|
||||
p.delay = 5000 # 5 second cycle
|
||||
p.colors = [(255, 255, 0)] # Yellow
|
||||
run_test_case(p, "Test 4: Very slow breathing (150-255 brightness)", 15000)
|
||||
|
||||
# Test Case 5: Very fast pulsing
|
||||
p.n1 = 50 # Min brightness 50
|
||||
p.brightness = 255 # Max brightness 255
|
||||
p.delay = 200 # 0.2 second cycle
|
||||
p.colors = [(255, 0, 255)] # Magenta
|
||||
run_test_case(p, "Test 5: Very fast pulsing (50-255 brightness)", 6000)
|
||||
|
||||
# Test Case 6: Low range, slow cycle
|
||||
p.n1 = 200 # Min brightness 200
|
||||
p.brightness = 255 # Max brightness 255
|
||||
p.delay = 4000 # 4 second cycle
|
||||
p.colors = [(0, 255, 255)] # Cyan
|
||||
run_test_case(p, "Test 6: Low range, slow cycle (200-255 brightness)", 12000)
|
||||
|
||||
# Test Case 7: High range, medium cycle
|
||||
p.n1 = 100 # Min brightness 100
|
||||
p.brightness = 255 # Max brightness 255
|
||||
p.delay = 1000 # 1 second cycle
|
||||
p.colors = [(255, 128, 0)] # Orange
|
||||
run_test_case(p, "Test 7: High range, medium cycle (100-255 brightness)", 8000)
|
||||
|
||||
# Test Case 8: Ultra fast strobe
|
||||
p.n1 = 100 # Min brightness 100
|
||||
p.brightness = 255 # Max brightness 255
|
||||
p.delay = 100 # 0.1 second cycle
|
||||
p.colors = [(128, 0, 255)] # Purple
|
||||
run_test_case(p, "Test 8: Ultra fast strobe (100-255 brightness)", 4000)
|
||||
|
||||
print("\n=== All tests completed ===")
|
||||
|
||||
# Turn off LEDs
|
||||
p.off()
|
||||
print("LEDs turned off")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_sine_brightness()
|
||||
Reference in New Issue
Block a user