#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const byte r = 4;
const byte c = 4;
byte rp[r] = {5, 4, 3, 2};
byte rc[c] = {A3, A2, A1, A0};
byte cc=0;
char keys[r][c] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'.', '0', '=', 'D'}
};
Keypad keypad = Keypad(makeKeymap(keys), rp, rc, r, c);
void setup() {
lcd.begin(16,2);
lcd.setCursor(1,0);
lcd.init();
lcd.backlight();
}
void loop() {
char key = keypad.getKey();
if (key) {
lcd.setCursor(cc,0);
lcd.print(key);
cc++;
}
if(cc == 17) {
lcd.clear();
cc = 0;
}
}