#include <Keypad.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C LCD = LiquidCrystal_I2C(0x27, 16, 2);
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 colPins[ROWS] = {5, 4, 3, 2};
byte rowPins[COLS] = {9, 8, 7, 6};
Keypad kpd = Keypad(makeKeymap(hexaKeys),rowPins, colPins, ROWS, COLS);
int seconds = 0;
String msg=("HIT A PAD KEY!");
int numBlinks;
int bt =500;
int j;
void setup()
{
Serial.begin(9600);
LCD.begin(16, 2);
LCD.print(msg);
}
void loop()
{
char key = kpd.getKey();
LCD.setCursor(0, 1);
LCD.print("");
if(key) // Check for a valid key.
{
LCD.print(key);
}
}