Hi all,
I’m trying to write an integer to EEPROM but have intermittent issues when I go to read it back. Below is the basic of what I’m trying to do:
int NextFeedTimeHr; // values from 1 to 23
int NextFeedTimeMin; // values 0 to 59
void setup(){
EEPROM.get(1, NextFeedTimeHr);
EEPROM.get(2, NextFeedTimeMin);
}
void loop(){
//do stuff then go to Set_Feed_Time() to change next feed time.....(only happens twice a day)
}
void Set_Feed_Time() {
EEPROM.put(1, NextFeedTimeHr);
EEPROM.put(2, NextFeedTimeMin);
}
Occasionally the value gets corrupted sometimes and i get a random large positive/negative number or it will not save to memory at all. Any suggestions?
FYI i just pull all power to the module and plug it back in to test to see if values will load back up correctly.