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>
20 lines
538 B
Python
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
|