To expand on @ScruffR’s answer, I usually use a struct with a version
field so I know when to initialize the storage.
const int currentVersion = 10;
struct {
int version;
int NextFeedTimeHr; // values from 1 to 23
int NextFeedTimeMin; // values 0 to 59
} storage;
void setup() {
EEPROM.get(0, storage);
if (storage.version != currentVersion) {
storage.version = currentVersion;
storage.NextFeedTimeHr = 18;
storage.NextFeedTimeMin = 0;
saveStorage();
}
}
void loop() {
// do stuff and call saveStorage() to persist data
}
void saveStorage() {
EEPROM.put(0, storage);
}