#include <EEPROM.h>
#include <LiquidCrystal_I2C.h>
int address = 2; // Address in EEPROM where the data will be stored
LiquidCrystal_I2C lcd(0x27,16,2);
int D=0;
void setup() {
// Initialize serial communication
Serial.begin(9600);
lcd.init();
lcd.backlight();
// Read the stored number from EEPROM
int storedNumber = EEPROM.read(address);
lcd.setCursor(0,0);
lcd.print(storedNumber);
lcd.clear();
delay(2000);
// If the stored number is not equal to 9999, write 9999 to EEPROM
if (storedNumber != 9999) {
EEPROM.write(address, 9999);
D=EEPROM.read(address);
lcd.setCursor(0,0);
lcd.print(D);
}
}
void loop() {
// Your main code here
}