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>
This commit is contained in:
19
examples/blink.py
Normal file
19
examples/blink.py
Normal file
@@ -0,0 +1,19 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user