Regularly write that data to NVM. Con: Saving the state, so that it make sense, must happen in the range of seconds, whereas powerdown is in the range of days. This ratio is very inefficient, as it wears down the NVM unnecessarily and wastes tons of processing cycles.
Build the circuit in a manner, where in case of circuit power loss:a) A certain circuit component continues to power the Arduino for a short "emergency shutdown" period,b) A certain circuit component triggers the Arduino,c) This event triggers the routine "save program state to non-volatile memory".
The provided code shows that the voltage monitoring must run continously in the main loop.
The provided example uses a 0.47F capacitor. In what price range is that?
The provided code shows that the voltage monitoring must run continously in the main loop. Is there no interrupt/event implementation within Arduino. (Sorry if my question is naive, I am a newbie)