#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

const int startPin = 2;
const int endPin = 3;
const int buzzer = 4;

int start, end_;

void setup() {
  Serial.begin(9600);
  lcd.begin(16, 2); // Specify the number of columns and rows
  lcd.backlight(); // Turn on the backlight
  lcd.clear();
  pinMode(buzzer, OUTPUT);
  pinMode(startPin, INPUT_PULLUP);
  pinMode(endPin, INPUT_PULLUP); // Corrected duplicate pinMode
}

void loop() {  
  start = digitalRead(startPin);
  end_ = digitalRead(endPin); 
  Serial.println(start);
  Serial.println(end_);
  
  if (start == LOW && end_ == LOW) {
    digitalWrite(buzzer, HIGH);
    delay(1000); 
    digitalWrite(buzzer, LOW); 
    lcd.setCursor(0, 0);
    lcd.print("Try Again");     
    Serial.println("Try Again");        
  }
  else if (start == HIGH && end_ == LOW) {
    lcd.setCursor(0, 0);
    lcd.print("Well Done");
    Serial.println("Well Done");
  }
  delay(500); 
}