examples(mcp23009e): Add practical usage examples. #74#187
Conversation
There was a problem hiding this comment.
Pull request overview
Adds four interactive MCP23009E example sketches demonstrating D-PAD input with LEDs, buzzer, timing, and Morse decoding.
Changes:
- Adds Simon-style memory game using D-PAD input and onboard LEDs.
- Adds reaction timer and melody player examples driven by D-PAD buttons.
- Adds Morse code input/decoder example.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 11 comments.
| File | Description |
|---|---|
lib/mcp23009e/examples/SimonGame/SimonGame.cpp |
Adds Simon-style sequence memory game. |
lib/mcp23009e/examples/ReactionTimer/ReactionTimer.cpp |
Adds LED-based reaction timer using the UP button. |
lib/mcp23009e/examples/MusicPlayer/MusicPlayer.cpp |
Adds D-PAD-triggered buzzer melodies. |
lib/mcp23009e/examples/MorseCode/MorseCode.cpp |
Adds Morse code input and serial decoding example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replace inactivity-based decoding with explicit user validation. UP button now records dots and dashes on release and provides immediate feedback in the serial monitor. DOWN button triggers Morse decoding of the current sequence. Also configure UP and DOWN inputs with pull-ups to ensure reliable button reads.
|
Thanks for the contribution! I made a couple of follow-up improvements while reviewing the examples:
I also opened a follow-up issue for a cross-driver enhancement:
With these changes, the PR satisfies the original issue requirements and provides a good set of practical MCP23009E examples. LGTM, ready to merge. |
|
🎉 This PR is included in version 0.20.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
Add four interactive example sketches for the MCP23009E driver.
close #74
Changes
Add
SimonSays— memory game using the D-PAD and on-board LEDs.The board shows a growing sequence of directions via coloured LEDs;
the player must replay it on the D-PAD. Score is printed to the
serial monitor.
Add
ReactionTime— reaction-time trainer. The red LED lights upafter a random delay (300–1500 ms); the player presses the UP button
as fast as possible and the elapsed time is printed to the serial
monitor.
Add
MelodyPlayer— plays a different 8-bit melody on the on-boardbuzzer depending on which D-PAD button is pressed: UP → Tetris,
DOWN → Mario, LEFT → Zelda, RIGHT → Pokémon.
Add
MorseDecoder— Morse code input via a single button. A shortpress (< 300 ms) inputs a dot, a long press inputs a dash. After
1 second of inactivity the accumulated code is decoded and the
matching letter is printed to the serial monitor.
Checklist
make lintpasses (clang-format)make buildpasses (PlatformIO)make test-nativepasses (if native tests exist)make test-hardwarepasses on a connected STeaMi (if hardware tests exist)