Add Docker deployment support, richer Selenium/LED pattern tests, in-browser diagnostics, responsive UI improvements, and 16x16 panel simulation tooling to speed iteration and hardware-style prototyping. Made-with: Cursor
34 lines
794 B
Python
34 lines
794 B
Python
"""16x16 rainbow wave animation."""
|
|
|
|
from machine import Pin
|
|
import neopixel
|
|
import time
|
|
|
|
from panel16_utils import PANEL_H, PANEL_W, clamp8, xy_to_index
|
|
|
|
|
|
np = neopixel.NeoPixel(Pin(4), PANEL_W * PANEL_H)
|
|
|
|
|
|
def wheel(pos: int) -> tuple[int, int, int]:
|
|
pos = 255 - (pos & 255)
|
|
if pos < 85:
|
|
return (clamp8(255 - pos * 3), 0, clamp8(pos * 3))
|
|
if pos < 170:
|
|
pos -= 85
|
|
return (0, clamp8(pos * 3), clamp8(255 - pos * 3))
|
|
pos -= 170
|
|
return (clamp8(pos * 3), clamp8(255 - pos * 3), 0)
|
|
|
|
|
|
for frame in range(240):
|
|
for y in range(PANEL_H):
|
|
for x in range(PANEL_W):
|
|
color_pos = ((x * 10) + (y * 6) + frame * 5) & 255
|
|
np[xy_to_index(x, y)] = wheel(color_pos)
|
|
np.write()
|
|
time.sleep(0.04)
|
|
|
|
np.fill((0, 0, 0))
|
|
np.write()
|