Final woking code in case someone else is having the same issue:
#include <LiquidCrystal.h>
#include <EEPROM.h>
LiquidCrystal lcd(13,12,11,10,9,8);
const long Limit = 5;
int count=0;
int relay = 3;
int sensor = 5;
const long HoldTime = 1800;
const long Wait1 = 600;
const long Wait2 = 800;
void setup() {
Serial.begin(9600);
lcd.begin(16,2);
pinMode(sensor, INPUT);
pinMode(relay, OUTPUT);
lcd.setCursor(0, 0);
lcd.print(" Counted: ");
lcd.setCursor(0, 2);
lcd.print(" ");
delay(500);
}
void loop() {
if (digitalRead(sensor) == HIGH) {
delay(Wait1);
digitalWrite(relay, HIGH);
delay(HoldTime);
lcd.setCursor(13,0);
lcd.print(++count);
Serial.println(count);
digitalWrite(relay, LOW);
delay(Wait2);
}
if(count > Limit -1){
digitalWrite(relay, LOW);
lcd.setCursor(0,1);
lcd.print("Empty & Reset");
while(count > Limit -1);
}
}