TinyGo 3 — UART timed sensor loop
TinyGo elective 3 — UART timed sensor loop
Elective · ~3h
Goal: Fixed-period sampling loop with deadline-miss counter and CSV/status lines over serial; mock or real ADC.
Theory
Soft realtime logging needs:
- Period
T(e.g. 50 ms → 20 Hz)
- Miss counter when work overruns
- Bounded work per tick (no unbounded alloc/print spam)
- UART as primary debug channel on MCUs
tick → read → filter (EMA) → print line → sleep until next deadline
Lab
- Configure
machine.Serialat 115200.
- Loop with
next += period; count misses when late.
- Mock sensor from time; optional real
machine.ADC.
- EMA filter; print
raw,ema,misses.
- Host:
picocom/screenon the serial device.
Full listing: monorepo Go project 43.
Checkpoint
- Stable serial stream
- Miss counter present
- Period chosen and justified
Next elective
TinyGo 4 — Cooperative tasks (95-tinygo-04-…).