Sensor Monitor
This teaching project runs the same C++ policy and command parser in a native terminal executable and an Arduino sketch. Every supplied input is synthetic. No board, sensor, upload, Wi-Fi service, paid API, or secret is needed for the core exercises.
The final release starts in FAULT with missing input, recovers after two consecutive valid samples, alerts at 28.0 °C, and clears at 27.0 °C. Missing, nonfinite, or stale input faults immediately. The alert threshold can change in RAM through a bounded terminal command.
Windows quick start
Extract the selected checkpoint into a new exercise folder. In PowerShell, change to its sensor-monitor folder. Install the versioned native compiler and Arduino CLI described in dependencies and setup, then run:
.\scripts\test.cmd
.\scripts\replay.cmd fixtures/normal.csv
.\scripts\build-firmware.cmd
$env:CXX = 'C:\path\to\clang++.exe' and $env:ARDUINO_CLI = 'C:\path\to\arduino-cli.exe' select explicit executables when needed. Each wrapper stops on compiler or executable failure. The cross-build performs no upload. The native compiler is separate from the ESP32 cross-compiler.
For terminal commands:
.\scripts\replay.cmd --commands
Enter threshold 30 then Enter. Enter threshold 28junk to see rejection. Press Ctrl+Z then Enter to end Windows terminal input. A new process restores 28.0 °C. Command mode demonstrates parser/configuration only; fixture mode supplies sample events. On the host appendix path, run python3 scripts/native.py test, python3 scripts/native.py replay, or python3 scripts/native.py commands with a C++17 compiler installed. The independent JSON replay checks use python3 scripts/native.py build then python3 tests/test_replay.py.
Read the project
- Requirements and timing contract
- Output and fixture formats
- Exact hardware reference and optional deployment
- Design decisions
- Checkpoint starts, recovery, and fault exercises
- Evidence limits and fresh-session handoff
- Skill discovery and behavior requests
The firmware deliberately acquires synthetic temperatures. Native replay proves software behavior; a successful cross-build proves compilation for the selected target. Neither establishes sensor accuracy, electrical compatibility, USB operation, or physical timing. No physical validation is claimed.