For my next Project I gave this a new try and the code posted by gerardwr works good, Thanks!
@draco: Should I commit this to the GitHub repo for you? I think it would be great to make it more available to the community by this.
With the latest ESP8266 Arduino IDE the the two files need to be placed here (I recommend to rename the origin files instead replacing them):
C:\Users\USERNAME\AppData\Roaming\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-673-g8cd3697\libraries\EEPROM
That is my test sketch in case some one want's to give this a try:
Code: Select all#include <EEPROM.h>
extern "C" {
#include "user_interface.h" //Needed for the reset command
}
char* charOut = "bla/bla_blub";
int intOut = 1;
String stringOut = "Test";
void setup() {
Serial.begin(115200);
EEPROM.begin(512);
int addr=0;
addr += EEPROM.put(addr, charOut);
yield();
Serial.println(addr);
addr += EEPROM.put(addr, intOut);
yield();
Serial.println(addr);
addr += EEPROM.put(addr, stringOut);
yield();
Serial.println(addr);
EEPROM.commit();
delay(5000);
String ssidIN;
String pwdIN;
int intIN;
char* charIN;
String stringIN;
addr=0;
addr += EEPROM.get(addr, charIN);
addr += EEPROM.get(addr, intIN);
addr += EEPROM.get(addr, stringIN);
EEPROM.commit();
Serial.println("char");
Serial.println(charIN);
Serial.println("int");
Serial.println(intIN);
Serial.println("string");
Serial.println(stringIN);
delay(5000);
}
void loop() {
delay(100);
Serial.println("Restarting!");
system_restart();
delay(200);
}