"""NeoPixel time-based animation test for the browser simulator.""" from machine import Pin import neopixel import time np = neopixel.NeoPixel(Pin(4), 50) def wheel(pos: int) -> tuple[int, int, int]: """Generate rainbow colors across 0-255 positions.""" pos = 255 - (pos & 255) if pos < 85: return (255 - pos * 3, 0, pos * 3) if pos < 170: pos -= 85 return (0, pos * 3, 255 - pos * 3) pos -= 170 return (pos * 3, 255 - pos * 3, 0) print("Starting NeoPixel time test...") for frame in range(60): for i in range(len(np)): np[i] = wheel((i * 256 // len(np) + frame * 4) & 255) np.write() time.sleep(0.08) np.fill((0, 0, 0)) np.write() print("NeoPixel time test complete.")