I am new to Arduino programming and I'm really fascinated with its working. Is there a way to know if an Arduino is getting switched off or being reset? Like a function would be called before the Arduino gets switched off.
I want to detect this event to preserve a value, where a user resets his Arduino, or switches it off. Is it possible?