Hi,
I have an input resource (slider widget) which is used for dynamically changing a variable in my sketch. I would like also to be able to write this variable into EEPROM so next reboot my device loads the saved value.
I am uncertain about what is the first free available address of the EEPROM. I use ThingerWebConfig.h with ESP8266 and what I am understanding is that somewhere the SSID, passoword, device credentials etc. should be stored. Is it safe to start write to EEPROM from address 0 ?
This is my example code:
#include <EEPROM.h>
int addr = 0;
void setup()
{
EEPROM.begin(512);
// Input resource to remotelly modify the maxDoorDistance variable defined as a global variable.
thing["maxDoorDistance"] << [](pson& in){
if (in.is_empty()){
in = maxDoorDistance;
} else {
maxDoorDistance = in;
EEPROM.write(addr, maxDoorDistance);
EEPROM.commit();
}
};
}
void loop(){
}