Inspecting contents of EEPROM

I’m using EEPROM to store some values, but it’s not quit working as I expected.

Now I’m just trying to view the contents of the first 10 addresses to see if everything is being set correctly, but this code seems to just cause the Spark to flash red until reset (although it verifies without errors):

uint8_t eepromAddress = 0;
String eepromString;
while(eepromAddress < 11) {
    eepromString += "|";
    eepromString += eepromAddress;
    eepromString += "-";
    eepromString += EEPROM.read(eepromAddress);
}
Spark.publish("EEPROM=", eepromString);

I’m an idiot, looking at it now I can see I forgot to increment the counter inside the loop.

This is now working for me, although I’m sure there are other improvements that can be made.

uint8_t eepromAddress = 0;
String eepromString;
while(eepromAddress < 11) {
    eepromString += "|";
    eepromString += eepromAddress;
    eepromString += "-";
    eepromString += EEPROM.read(eepromAddress);
    eepromAddress++;
}
Spark.publish("EEPROM=", eepromString);
1 Like