Read last saved value from EEPROM

Hi all!
I am working with ATmega328p MCU
I have successfully done Write & Read value from a fixed address.
Now i am using all address to Write the value. (ex: 0 to 1023 in ATmega328p)
I have done it with a for loop and i also reading all the value from address with another for loop.
But i need to retrieve the last saved value from EEPROM when it powered ON from OFF state.
How can i do this? Please help.

Thanks in advance...


Seed the EEPROM to a value you won't use, read until this value is found, then return the previous location value.

Can you give me the example code?

I am working with a remote controlled fan regulator. I want to save the speed limit of the fan so that its speed is same as before if power restart.
I am using a fixed address for storing the value. but each address write cycle is 100000. In this case i want to use all the address of EEPROM.

Can you give me the example code?

look into the EEPROM library


Thanks :slight_smile: