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:
committed by
Develo
parent
244dbd7713
commit
2b9fcdb568
@ -14,7 +14,7 @@ byte value;
|
||||
|
||||
void setup() {
|
||||
// initialize serial and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
Serial.begin(115200);
|
||||
while (!Serial) {
|
||||
; // wait for serial port to connect. Needed for Leonardo only
|
||||
}
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user