Sorry I meant the eeprom
I guess I will have to write the current mode and brightness to flash each time it gets changed
I guess you won't. Flash memory is read-only. EEPROM might be usable, but not EVERY time mode and brightness change. Why not just start a given cycle over?
Not sure I follow you Paul - somehow I would like to work out where the code was when it was powered off?
Because of the limited wear cycles of EEPROM its best to only remember settings at explicit user
request, or to institute a quite large delay before updating EEPROM (no more than once an hour?)
so as to prevent premature EEPROM failure.
If you want to extend the life of EEPROM you could assign a buffer in EEPROM, each entry
being updated round-robin style (with a sequence number), sharing the wear over many
entries. At reset you read all the entries to determine the one with the highest/latest sequence
Thanks for the info, that sounds mighty complicated for me though
is there somewhere I could read up on it or a tutorial that you are aware of?
How many writes on average are we talking before the eeprom becomes damaged?