#include <LiquidCrystal.h>
#include <Keypad.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
const uint8_t ROWS = 4;
const uint8_t COLS = 3;
char keys[ROWS][COLS] = {
{ '1', '2', '3'},
{ '4', '5', '6'},
{ '7', '8', '9'},
{ '*', '0', '#'}
};
uint8_t colPins[COLS] = { 2, 13, A5}; // Pins connected to C1, C2, C3,
uint8_t rowPins[ROWS] = { 6, 5, 4, 3 }; // Pins connected to R1, R2, R3, R4
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
}
void processInput(char key) {
lcd.print(key);
}
void loop() {
char key = keypad.getKey();
if (key) {
processInput(key);
}
}