#include <Keypad.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
const int baris = 4;
const int kolom = 4;
char keys [baris][kolom] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'},
};
byte rowspin [baris] = {14,12,19,18};
byte colspin [kolom] = {5,4,2,15};
Keypad keypad = Keypad(makeKeymap(keys), rowspin, colspin, baris, kolom);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.init ();
lcd.backlight ();
lcd.setCursor (0,0);
}
void loop() {
// put your main code here, to run repeatedly:
char key = keypad.getKey();
if (key != NO_KEY) {
lcd.print(key);
}
}