Skip to content

examples(mcp23009e): Add practical usage examples. #74#187

Merged
Charly-sketch merged 11 commits into
mainfrom
feat/mcp23009e-example
Jun 17, 2026
Merged

examples(mcp23009e): Add practical usage examples. #74#187
Charly-sketch merged 11 commits into
mainfrom
feat/mcp23009e-example

Conversation

@DumontALINE

@DumontALINE DumontALINE commented May 28, 2026

Copy link
Copy Markdown
Contributor

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 up
    after 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-board
    buzzer 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 short
    press (< 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 lint passes (clang-format)
  • make build passes (PlatformIO)
  • make test-native passes (if native tests exist)
  • make test-hardware passes on a connected STeaMi (if hardware tests exist)
  • README updated (if adding/changing public API)
  • Examples added/updated (if applicable)
  • Commit messages follow conventional commits format

Copilot AI review requested due to automatic review settings May 28, 2026 07:22
@github-actions github-actions Bot added this to the Phase 3 — Drivers simples milestone May 28, 2026
@DumontALINE DumontALINE requested a review from nedseb May 28, 2026 07:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/mcp23009e/examples/SimonGame/simon_game.ino
Comment thread lib/mcp23009e/examples/ReactionTimer/reaction_timer.ino
Comment thread lib/mcp23009e/examples/MusicPlayer/music_player.ino
Comment thread lib/mcp23009e/examples/MorseCode/morse_code.ino
Comment thread lib/mcp23009e/examples/MusicPlayer/music_player.ino
Comment thread lib/mcp23009e/examples/SimonGame/simon_game.ino Outdated
Comment thread lib/mcp23009e/examples/MusicPlayer/music_player.ino Outdated
Comment thread lib/mcp23009e/examples/MorseCode/morse_code.ino Outdated
Comment thread lib/mcp23009e/examples/ReactionTimer/reaction_timer.ino
Comment thread lib/mcp23009e/examples/ReactionTimer/reaction_timer.ino
DumontALINE and others added 7 commits May 28, 2026 09:32
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.
@Charly-sketch

Copy link
Copy Markdown
Contributor

Thanks for the contribution!

I made a couple of follow-up improvements while reviewing the examples:

  • fix(mcp23009e): Simplify Morse decoder interaction.

    • Reworked the Morse code workflow to be more responsive.
    • Immediate feedback is now provided after each button release (Dot / Dash).
    • Decoding is now triggered explicitly with the DOWN button instead of waiting for an inactivity timeout.
    • Added proper MCP23009E input configuration with pull-ups.
  • docs(mcp23009e): Add examples in README.

    • Added an Examples section to the MCP23009E README.
    • Documented all available example sketches and their purpose.
    • Added build/flash instructions consistent with other drivers.

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.

@Charly-sketch Charly-sketch merged commit db38048 into main Jun 17, 2026
12 checks passed
@Charly-sketch Charly-sketch deleted the feat/mcp23009e-example branch June 17, 2026 08:49
@semantic-release-updater

Copy link
Copy Markdown

🎉 This PR is included in version 0.20.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

examples(mcp23009e): Add practical usage examples.

4 participants