#include <LiquidCrystal.h>
#include <Keypad.h>
const int rs = 15, en = 4, d4 = 18, d5 = 19, d6 = 21, d7 = 22;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys[ROWS][COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = {26, 27, 2, 5};
byte colPins[COLS] = {13, 12, 34, 35};
Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup()
{ Serial.begin(9600);
lcd.begin(16, 2);
}
void loop() {
char customKey = customKeypad.getKey();
lcd.write(Serial.read());
if (customKey) {
Serial.println(customKey);
lcd.clear();
}
}