#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'}
{'7','8','9','C'}
{'*','0','#','D'}
};
byte rowPins[ROWS] = {13, 12, 14, 27};
byte colPins[COLS] = {26, 27, 33, 32};
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS);
LiquidCrystal_I2C lcd(0x27, 28,4);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Keypad dan LCD 12C";
lcd.setCursor(0,1));
lcd.print("Silahkan masukan tombol")
}
void loop() {
char key = keypad.getKey();
if (key) {
lcd.clear();
lcd.setCursor(0,0);
lcd.print("tombol ditekan:");
lcd.setCursor(0,1);
lcd.print();
}
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}