Early in my exploration of robotics on the Arduino platform, I ran into a number of issues simultaneously that needed addressing before I could move forward like I wanted:
- The setup()/loop() model of programming was pretty simplistic. I was thinking in terms of multiple subsystems all doing their own thing and interacting, but the Arduino just gives you “do this, over and over”.
- loop() starts executing immediately; but especially with something like a robotics project you want a chance to disconnect the USB cable and put the robot on the floor before it gets started (or get to a safe distance, depending on your application).
- Sometimes you want to shut the robot down from a distance, when it gets out of control.
In my previous blog post I showed how to record then recognize an IR message from a remote control button press, and in this post I’m going to introduce the scheduling framework I am using, and show how to use the remote control to switch between a dormant ‘sleep mode’ (sits quietly while an LED blinks) and normal operating ‘awake’ mode when it otherwise follows it’s programming.