#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Define push button pins
const int buttonPins[6] = {2, 3, 4, 5, 6, 7};
// Corresponding characters
const char characters[6] = {'A', 'E', 'G', 'U', 'T', 'C'};
void setup() {
lcd.begin();
lcd.backlight();
// Set button pins as input with internal pull-up resistors
for (int i = 0; i < 6; i++) {
pinMode(buttonPins[i], INPUT_PULLUP);
}
}
void loop() {
for (int i = 0; i < 6; i++) {
if (digitalRead(buttonPins[i]) == LOW) { // Button pressed
lcd.clear();
lcd.setCursor(0, 0); // Set cursor to the first line
lcd.print("Character: ");
lcd.print(characters[i]);
delay(300); // delay
}
}
}