I would like to have something save to the EEPROM every 1 minute while running a bunch of other code. Is it best to just have a variable count up in the Arduino or should I get an external counter?
See the "blink without delay" example that comes with the Arduino IDE for how to time events.
Using millis() for timing. A beginners guide
and
Several things at the same time have further examples of using millis() for timing and explain how to do it,
save to the EEPROM every 1 minute
Not a great idea... the EEPROM has a finite number of write cycles before it fall over.
Sure it will take a while (?approx 34 days?), but there are better ways to save your live variables.
e.g.
- Only when they change (if less often than 60-sec)
- Only on brownout/power loss (with a decent capacitor on the Vcc input)
- As determined by your program logic
etc.
lastchancename:
Not a great idea... the EEPROM has a finite number of write cycles before it fall over.
Sure it will take a while (?approx 34 days?), but there are better ways to save your live variables.
once a minute?
There are EEPROM wear leveling techniques that could make that more like a hundred years.
If you are making a counter that needs to survive power cycles and/or resets, EEPROM will do the job.