#include <LiquidCrystal_I2C.h>
#include <Keypad.h>

const int ROW_NUM = 4;  // four rows
const int COL_NUM = 4;  // four columns

char keys[ROW_NUM][COL_NUM] = {
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};
byte row_pins[ROW_NUM] = {13, 12, 14, 27};
byte col_pins[COL_NUM] = {26, 25, 33, 32};

Keypad keypad = Keypad( makeKeymap(keys), row_pins, col_pins, ROW_NUM, COL_NUM );
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
  Serial.begin(115200);
  lcd.init();
  lcd.backlight();
  lcd.print("Ready");
  Serial.println("\nReady...\n");
}

void loop() {
  delay(10); // this speeds up the simulation
  char key = keypad.getKey();

  if (key) {
    lcd.clear();
    Serial.println(key);
    lcd.print(key);
  }
}