#include <LiquidCrystal.h>
#include <Keypad.h>
LiquidCrystal lcd(12,11,10,9,8,7);
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);
}
void loop() {
char key = keypad.getKey();
if (key) {
lcd.setCursor(cc,0);
lcd.print(key);
cc++;
}
if(cc == 17) {
lcd.clear();
cc = 0;
}
}