Files
led-simulator/examples/blink.py
Jimmy 42c14361e8 feat(simulator): add GUI runner, stubs, and workspace assets
Add host simulator scaffolding, examples, and docs so led-driver main can run end-to-end with MicroPython module stubs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-04 22:48:54 +12:00

20 lines
538 B
Python

"""Example pattern for led-simulator / led-driver (generator + yield per tick)."""
import utime
class Blink:
def __init__(self, presets):
self.presets = presets
def run(self, preset):
colors = preset.c if preset.c else [(255, 255, 255)]
idx = 0
delay_ms = max(1, int(preset.d))
while True:
rgb = colors[idx % len(colors)]
self.presets.fill(self.presets.apply_brightness(rgb, preset.b))
yield
utime.sleep_ms(delay_ms)
idx += 1