Skip to content

Commit 3829af2

Browse files
author
Nathan Seidle
committed
Add re-write test to example 2.
This helps verify the EEPROM lib is erasing flash.
1 parent 2433f67 commit 3829af2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libraries/EEPROM/examples/Example2_AllFunctions/Example2_AllFunctions.ino

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ void setup()
150150
double myValue11 = -290.3485723409857;
151151
double myValue12 = 384.95734987;
152152
double myValue13 = 917.14159;
153+
double myValue14 = 254.8877;
153154
randomLocation = random(0, AP3_FLASH_EEPROM_SIZE);
154155

155156
startTime = millis();
@@ -169,6 +170,11 @@ void setup()
169170
Serial.printf("Location %d should be %lf: %lf\n", randomLocation, myValue11, response11);
170171
Serial.printf("Location %d should be %lf: %lf\n", randomLocation + 8, myValue12, response12);
171172
Serial.printf("Edge of EEPROM %d should be %lf: %lf\n", EEPROM.length() - sizeof(myValue13), myValue13, response13);
173+
174+
double response14;
175+
EEPROM.put(EEPROM.length() - sizeof(myValue14), myValue14); //Test the re-write of a spot
176+
EEPROM.get(EEPROM.length() - sizeof(myValue14), response14);
177+
Serial.printf("Rewrite of %d should be %lf: %lf\n", EEPROM.length() - sizeof(myValue14), myValue14, response14);
172178
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
173179

174180
Serial.println("");

0 commit comments

Comments
 (0)