// include the library code:
#include <LiquidCrystal.h>
#include <Wire.h>
const int buttonPin1 = 2; // Replace with the GPIO pin connected to your first button
const int buttonPin2 = 3; // Replace with the GPIO pin connected to your second button
const int lcdAddr = 0x27; // I2C address of your LCD, may vary
LiquidCrystal lcd(19, 23, 18, 17, 16, 15);// Adjust the dimensions based on your LCD
void setup() {
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
lcd.begin(16, 2);
lcd.print("ESP32 LCD Demo");
}
void loop() {
// Check button states
if (digitalRead(buttonPin1) == HIGH) {
lcd.setCursor(0, 1);
lcd.print("Button 1 pressed");
}
if (digitalRead(buttonPin2) == HIGH) {
lcd.setCursor(0, 1);
lcd.print("Button 2 pressed");
}
// Add any other tasks or code you need in the loop
}