In the code below, how do I add a default value, so that if the settings are deleted from eeprom, a default value will be given? I want these default values:
MySettings.lightLevel = 800
MySettings.motor_delay = 40
struct config_settings {
int mySensVals[12]; //# of pulses in 2-12 cups
int motor_delay; //change the distance the platform travels
int lightLevel; //photocell trigger level
boolean Enable_Audio; //whether the user wants sound
boolean Enable_Piezo; //whether the user wants a knock sensor
boolean Enable_PhotoCell; //whether the user wants to use the photocell
} MySettings;
void LoadSettings(){
EEPROM_readAnything(0, MySettings); //load the settings
}
void SaveSettings(){
EEPROM_writeAnything(0, MySettings); //save the settings
}