EEPROM: number in different from number out?

Is this a software or hardware question? I don’t know.

I’m reading from an analog input and averaging the number, then saving it to the EEPROM.
When I read it, its different.

This must be something simple, I just can’t figure it out. Thanks for your help!

EEPROM_Test.ino (1.09 KB)

An eeprom address only holds a single byte where as total is an int aka two bytes. Use EEPROM.put() and EEPROM.get().

Also, I would suggest tidying your code. Press Ctrl+t to let the IDE do a small part. But the biggest part is up to you. Namely nothing follows a ; in clean code...

Also note, EEPROM has a limited amount of write cycles. In this pace you've run out of write cycles in a bit over 3 days...

thank you.

and thanks for ctrl-t! i didn't know