this code not working to store led please help me to correct this

please help to store ledstate
I am a beginner
i want to store delay time also but
i press reset this start from the beginning

#include <EEPROM.h>

int ledPin = 12 ;

void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin (9600);
EEPROM.read(0);
}
void loop() {
digitalWrite(ledPin, HIGH);
delay(1000);
EEPROM.update(0,0);

digitalWrite(ledPin, LOW);
delay(10000);
EEPROM.update(0,1);
}

EEPROM.read(0);
  EEPROM.read(1);

Why?
Did you forget something?

Please remember to use code tags when posting code

In setup()

  EEPROM.read(0);

This reads the value at address 0 and the throws that value away. You would typically store that value in a variable

byte var =  EEPROM.read(0);

Also note that EEPROM does not have an infinite life. You can only write to it ~100K times. Your code does this every second so it will add up in a hurry. Why do you need to retain this value in EEPROM?

Time to read :wink:

Read
https://www.arduino.cc/en/Reference/EEPROMRead

Write
https://www.arduino.cc/en/Reference/EEPROMWrite

Also, be careful:

“The EEPROM memory has a specified life of 100,000 write/erase cycles, so you may need to be careful about how often you write to it.”

Why have yo started another thread about storing values to EEPROM ?

Why do you want to store it to EEPROM? You can store it in the program memory with the bool value. You might damage the EEPROM with multiple uses.

..Arnav

This is why you should always state what libraries you are using.
External EEPROM still has limitations. It may do slightly better than the internal EEPROM. Perhaps an order of magnitude (10x].

The exact way to use external eeprom will surely depend on the make and model of that eeprom.

There is (for example) an explanation of i2c eeprom here in the Playground.