#include <LiquidCrystal_I2C.h>
// Import ezButton library
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 20, 4);
int excellentCount = 0;
int goodCount = 0;
int badCount = 0;
// Declare all feedback variables and set in numbers
// Declare showFeeback as flag variable and set initial value to false
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
// Set the debounce time for each button
// Initilized the LCD
}
void loop() {
// Call loop method for each button
// Detect the button press and take action accordingly
// Call the function showFeedbackResults()
delay(10);
}
void initilizeLcd(){
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Welcome to Star Fun!");
lcd.setCursor(0, 1);
lcd.print("We'd love to hear ");
lcd.setCursor(0, 2);
lcd.print("your feedback about");
lcd.setCursor(0,3);
lcd.print("our service!");
}
void showFeedbackResults(){
lcd.setCursor(0,0);
lcd.print("Excellent: ");
lcd.print(excellentCount);
lcd.setCursor(0,1);
lcd.print("Good: ");
lcd.print(goodCount);
lcd.setCursor(0,2);
lcd.print("Bad: ");
lcd.print(badCount);
delay(5000);
lcd.clear();
// Set the showFeedback to false
initilizeLcd();
}