Answer to "Multiple Auto modes?"

This can be done by creating a “master” program in main() that watches for your program selection. There are lots of options for selecting your program: counting limit switch presses, the channel 5 & 6 buttons on the remote, looking at the position a potentiometer is set to, looking for the presence/absence of jumpers. When the master program gets a selection, it calls down into the appropriate function.

You can structure this two ways: The easiest is to have the robot do nothing until it gets a selection, then the selected function takes over and runs until you turn the robot off. You can then turn it back on to pick a different program. This approach is discussed a bit in this thread.

The harder way has the master program “in the control loop” so that you can change programs on the fly. I’ve used this to enable/disable particular features of a program (rather than select whole different programs) with great success. I posted some sample code in this thread.

Both these approaches require that all the programs are compiled together as a single project and downloaded as a single hex file. It isn’t possible to independently download multiple hex files and select between them, though that would be a cool feature.


  • Dean