Move the app under src/, add ring-spanning patterns with shared fonts and beat-driven motion, and wire global audio settings into the web UI. Co-authored-by: Cursor <cursoragent@cursor.com>
43 lines
1.2 KiB
Python
Executable File
43 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Cycle full-panel red / green / blue on Pico panel(s)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
import sys
|
|
import time
|
|
|
|
from leds.colors import RGB_CYCLE
|
|
from leds.panel_udp import PanelClient, add_panel_args, format_panel_targets, panel_targets_from_args
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(description="RGB cycle on Pico panel(s)")
|
|
add_panel_args(parser)
|
|
parser.add_argument("--pause", type=float, default=1.0)
|
|
args = parser.parse_args()
|
|
|
|
targets = panel_targets_from_args(args)
|
|
print(
|
|
f"RGB cycle -> {format_panel_targets(targets, args.port)} "
|
|
f"brightness={args.brightness:g} (Ctrl+C to stop)"
|
|
)
|
|
|
|
try:
|
|
with PanelClient.from_args(args) as client:
|
|
while True:
|
|
for label, color in RGB_CYCLE:
|
|
print(f" {label}")
|
|
client.fill(color)
|
|
time.sleep(args.pause)
|
|
except KeyboardInterrupt:
|
|
print("\nStopped.")
|
|
except OSError as exc:
|
|
print(f"Network error: {exc}", file=sys.stderr)
|
|
return 1
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|