The following snippet is responsible for storing a variable to EEPROM:
Code: Select all
int DeviceSettings::storeString(const char* key, const char* value){
preferences.begin(name_space, false);
Serial.println(preferences.putString(key, value), DEC);
preferences.end();
}
When i try to fetch the before stored variable using this code:
Code: Select all
void DeviceSettings::fetchString(const char* key, char* value){
preferences.begin(name_space, false);
Serial.println(preferences.getString(key, value, 200), DEC);
Serial.println(value);
preferences.end();
}
I can't seem to understand what's happening. Both methods receive the same key:
Code: Select all
settings.storeString(SETTINGS_APP_NAME,"Chris van Diemen");
char * s;
settings.fetchString(SETTINGS_APP_NAME, s);