How to Save Value from Counter to EEPROM in Arduino Uno [solved]

UKHeliBob:

 EEPROM.write(sensorState, sensorState);

This will write 0 to EEPROM address 0 every time you start or reset the Arduino. Is that what you want ?

Then you never read from the EEPROM so why bother writing to it ?

no, what i want is when the counter is running like 1,2,3,4,5,6. so i turn off my arduino at 6 value, when i turn it on again it still at 6 instead of 0.