#include <Keypad.h>
#define ROW_NUM 4 // four rows
#define COLUMN_NUM 3 // three columns
char keys[ROW_NUM][COLUMN_NUM] = {
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
{'*', '0', '#'}
};
byte pin_rows[ROW_NUM] = {16, 17, 18, 19};
byte pin_column[COLUMN_NUM] = {25, 26, 27}; // GPIO4, GPIO0, GPIO2 connect to the column pins
Keypad keypad = Keypad( makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COLUMN_NUM );
void setup()
{
Serial.begin(115200);
Serial.println("The sketch has started");
}
void loop()
{
char key = keypad.getKey();
if (key)
{
Serial.println(key);
}
delay(10); // helps the simulation
}