// https://forum.arduino.cc/t/button-box-missing-button/1167209/
// https://www.baldengineer.com/arduino-keyboard-matrix-tutorial.html
// https://learn.sparkfun.com/tutorials/button-pad-hookup-guide
// https://www.youtube.com/watch?v=Z7Sc4MJ8RPM
#include <Keypad.h>
// const int ROWS = 4;
// const int COLS = 4;
const byte ROWS = 5;
const byte COLS = 5;
int buttons[ROWS][COLS] = {
// { '0', '1', '2', '3' },
// { '4', '5', '6', '7' },
// { '8', '9', 'A', 'B' },
// { 'C', 'D', 'E', 'F' }
{ '0', '1', '2', '3', '4' },
{ '5', '6', '7', '8', '9' },
{ 'A', 'B', 'C', 'D', 'E' },
{ 'F', '+', '-', '/', '*' },
{ '=', '.', '%', '&', '|' }
};
// byte rowPins[ROWS] = { 2, 3, 4, 5};
// byte colPins[COLS] = {10, 9, 8, 7};
byte rowPins[ROWS] = { 2, 3, 4, 5, 6};
byte colPins[COLS] = {11, 10, 9, 8, 7};
Keypad customKeypad = Keypad(makeKeymap(buttons), rowPins, colPins, ROWS, COLS);
void setup() {
Serial.begin(9600);
for (int i = 0; i < ROWS+1; i++) {
pinMode(rowPins[i], INPUT); // Method 2: rows INPUT/HIGH
// pinMode(rowPins[i], INPUT_PULLUP); // rows INPUT/HIGH, cols OUTPUT/LOW
}
for (int i = 0; i < COLS+1; i++) {
pinMode(colPins[i], INPUT_PULLUP); // Methow 2: cols INPUT/HIGH
// digitalWrite(colPins[i], HIGH); // Method 2: cols HIGH
// pinMode(colPins[i], OUTPUT); // cols OUTPUT
// digitalWrite(colPins[i], LOW); // cols LOW
}
}
void loop() {
// char customKey = customKeypad.getKey();
// if (customKey) {
// Serial.print(customKey);
// }
}