1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

Add EEPROM debug printouts, error check to example (#6556)

* Add EEPROM debug printouts, error check to example

Add debug printouts when EEPROM calls fail, even if the API doesn't
allow returning a success/failure code.

Adds error checking to the example to make it explicit that when you
call EEPROM::commit(), you need to look at the result code in your code.

Fixes #6551 , or would fix it if there was error checking in the MCVE.

* Clarify example error message
This commit is contained in:
Earle F. Philhower, III
2019-09-26 10:48:04 -07:00
committed by Develo
parent 244dbd7713
commit 2b9fcdb568
3 changed files with 38 additions and 11 deletions

View File

@ -13,6 +13,7 @@
int addr = 0;
void setup() {
Serial.begin(115200);
EEPROM.begin(512);
}
@ -33,7 +34,11 @@ void loop() {
addr = addr + 1;
if (addr == 512) {
addr = 0;
EEPROM.commit();
if (EEPROM.commit()) {
Serial.println("EEPROM successfully committed");
} else {
Serial.println("ERROR! EEPROM commit failed");
}
}
delay(100);