h1d/agent-skills-esp32
Overview
This skill sends text commands over a USB serial connection to an ESP32 or other microcontroller to emulate button presses, navigate screens, change modes, and trigger user actions. It is designed for automated testing, stress testing, and remote debugging so you can exercise device behavior without physical interaction. The approach works with both ESP-IDF and Arduino firmware that parse incoming serial lines.
How this skill works
The device runs a simple serial-command parser that reads lines from stdin/Serial, maps commands (like PRESS, SCREEN:<n>, MODE:<name>) to callbacks, and optionally echoes status back. The host side locates the serial device and writes commands with simple shell utilities (echo or scripts) or loops for automated sequences. You can combine command loops with log monitoring to correlate inputs and device output in real time.
When to use it
- Automated UI testing where physical buttons are impractical
- Stress or endurance tests that require thousands of input events
- Regression tests that need reproducible action sequences
- Remote debugging when access to the device physically is limited
- Continuous integration hooks that trigger device behavior from CI jobs
Best practices
- Implement a compact, robust line parser on the device that trims and validates input
- Echo acknowledgements or status (OK/ERROR) for each command to enable reliable automation
- Add small delays between commands to avoid overrunning the device’s event handling
- Use parameterized commands (SCREEN:, PRESS:<n>, MODE:) for flexible tests
- Monitor device logs in parallel to verify state transitions and detect errors early
Example use cases
- Run a 24/7 stability test sending PRESS every 30 seconds and capture logs for crashes
- Automate navigation through screens to verify layout rendering after firmware updates
- Run stress loops that simulate rapid button presses to uncover debouncing or memory issues
- Trigger specific modes (MODE:debug) to collect more verbose logs during fault reproduction
- Integrate serial commands into CI to run acceptance tests on physical hardware labs
FAQ
Use a pattern like ls /dev/cu.usbmodem* /dev/ttyUSB* /dev/ttyACM* and pick the first entry. Export it to a PORT variable for scripts.
What should the device return after a command?
Return a short acknowledgement such as OK or ERROR and log the received command to help automation verify delivery and diagnose failures.
2 skills
This skill helps you automate ESP32 testing by sending serial commands to emulate button presses and navigation actions.
This skill helps you monitor ESP32 serial output in real time, capture logs to a file, and analyze debugging messages efficiently.