A keypad-driven LED controller for Raspberry Pi Pico W (RP2040).
This repository is cleaned and documented from the provided source and Wokwi hardware diagram, while preserving firmware behavior.
The provided firmware is C/C++ using Arduino-style APIs (setup(), loop(), Keypad.h).
- Target hardware: Raspberry Pi Pico W
- Recommended build/upload path: Arduino IDE (Arduino-Pico core) or PlatformIO
- Included: Pico-style repository structure with documentation
- Included
CMakeLists.txt: structure placeholder for future Pico SDK migration
.
├── CMakeLists.txt
├── include/
├── src/
│ └── main.cpp
├── docs/
│ ├── architecture.md
│ ├── wiring.md
│ └── wokwi/
│ └── diagram.json
└── README.md
- Reads a 4x4 matrix keypad (16 keys).
- Controls 12 LEDs mapped to keypad actions:
1..8turn on individual blue LEDs9turns ON LEDs1..80turns OFF LEDs1..8A..Dturn on individual red LEDs*turns ON red LEDsA..D#turns OFF red LEDsA..D
- Maintains non-blocking polling loop (10 ms delay per cycle).
- 1x Raspberry Pi Pico / Pico W board
- 1x 4x4 membrane keypad
- 12x LEDs (8 blue + 4 red)
- 12x 220 Ω resistors (LED current limiting)
- 4x 1 kΩ resistors (keypad row pull-ups to 3V3)
- Jumper wires
Detailed table is in docs/wiring.md.
- LEDs: GP11, GP10, GP9, GP8, GP7, GP6, GP5, GP4, GP3, GP2, GP28, GP27
- Keypad rows: GP26, GP22, GP21, GP20
- Keypad cols: GP19, GP18, GP17, GP16
- Install Arduino IDE.
- Install Arduino-Pico board package (Raspberry Pi Pico/RP2040 core).
- Install
Keypadlibrary from Library Manager. - Select board: Raspberry Pi Pico W.
- Open
src/main.cpp(or copy content into an Arduino sketch). - Upload to Pico W.
- Create a PlatformIO project for
raspberrypi/ Pico W with Arduino framework. - Place
src/main.cppinsrc/. - Add dependency
Keypad. - Build and upload.
- Create a new Raspberry Pi Pico project in Wokwi.
- Replace the generated
diagram.jsonwithdocs/wokwi/diagram.json. - Use the C++/Arduino firmware from
src/main.cpp. - Start simulation and press keypad buttons to observe LED behavior.
- The current firmware does not use Pico W Wi-Fi.
- If Wi-Fi is added later, keep credentials in a separate local config file (excluded via
.gitignore) and never hardcode secrets.
Core logic in src/main.cpp is preserved from the provided code; only repository organization and documentation were added.