#include <Keypad.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
char keys[4][4] = {
  {'7','8','9','A'},
  {'4','5','6','B'},
  {'1','2','3','C'},
  {'*','0','#','D'}};
byte rowPins[4] = {7,6,5,4}; 
byte colPins[4] = {3,2,1,0}; 
Keypad keypad = Keypad(makeKeymap(keys),rowPins,colPins,4,4);
void setup()
{
  lcd.begin();
  lcd.setCursor(0,0);
}
void loop()
{
  char key = keypad.getKey();
  if (key != NO_KEY)
  {
    lcd.print(key);
  }
}
