// Based on: https://wokwi.com/projects/457240084752057345
// But now with labels to the buttons.
#include <Keypad.h>
const uint8_t ROWS = 5;
const uint8_t COLS = 5;
char keys[ROWS][COLS] = {
{ '0', '1', '2', '3', '4' },
{ '5', '6', '7', '8', '9' },
{ 'A', 'B', 'C', 'D', 'E' },
{ 'F', 'G', 'H', 'I', 'J' },
{ 'K', 'L', 'M', 'N', 'O' },
};
uint8_t colPins[COLS] = { 10, 9, 8, 7, 6 }; // Pins connected to C1, C2, C3, C4, C5
uint8_t rowPins[ROWS] = { 11, 2, 3, 4, 5 }; // Pins connected to R1, R2, R3, R4, R5
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup() {
Serial.begin(9600);
}
void loop() {
char key = keypad.getKey();
if (key != NO_KEY) {
Serial.println(key);
}
}5x5 keyboard matrix with labels.