When you load a sketch the EEPROM is erased. It is used to save data across resets and power cycles, not for saving data between sketches.
As Paul stated that is not what happens. The arduino bootloader and AVRDUDE do have the capability to read, write or erase the EEPROM memory, however the arduino IDE does not do that as part of a upload operation.
Not unless that sketch explicitly erases it. One can store data in EEPROM, make changes to the sketch, and upload again. Saved data is still there.
It doesn't get initialized on upload??? I thought when it said "Locations that have never been written to have the value of 255." it meant "written by this sketch". Silly me.
I guess it's not necessary. One could tag the EEPROM with a hash of the build date/time. If the tag wasn't already set the sketch is new and should initialize the EEPROM with reasonable defaults.
Where is the part that actually writes the EEPROM in the original code?
from:
"store values ... into the EEPROM using theEEPROM.write() function. These values will stay in the EEPROM when the board is turned off and may be retrieved later by another sketch."
// write the value to the appropriate byte of the EEPROM.
// these values will remain there when the board is
// turned off.
EEPROM.write(addr, val);
Ok well then I presume there must be something wrong with the example sketch. My sketches were nothing more then a stripped down version of example sketch.
Well, I see some EEPROM references within DB.h, guess it is being done there:
int EEPROM_dbWrite(int ee, const byte* p);
int EEPROM_dbRead(int ee, byte* p);
These libraries & classesand whatnot are convenient, pain in the butt debugging when you have do a bunch of digging in multiple locations to see what they really do.