How would you go about implementing a single pushbutton ON/OFF control for a device?
The program flow could be something like this:
1) Battery connected;
3) If button pressed, run init: procedure and do main: continuously;
4) If button pressed for like three seconds, run...