Pre_Auton Function Autonomous Selection

So, I have a program that allows us to choose the autonomous program using the LCD screen. When I click the center button, it confirms the choice. As of now, I have a time-out after 7 seconds; if the autonomous isn’t chosen, then the first option is selected. The time-out is because, if I forget to choose the autonomous, the program will not stay inside the pre_auton function and go to the autonomous task. Instead of using the time-out, is there a way for the robot to “know” that the autonomous task is being called and then exit pre_auton and run the autonomous task?
Thanks :slight_smile: !

you could have
unless (button press on lcd) then let you choose
wait (3 seconds)
otherwise (wait 7 seconds then go to auton 1)

Thanks for your reply, but I was wondering if there was a way to do it without timers at all, just be able to choose auton for as long of a period of time as possible, until the auton task starts.

jpearman posted some code that does what you’re talking about, I think.


And he talks about it here in amazing detail:

In a switch/case structure, you can have a case named “default” that will be run if no selections are made. In the robotC sample programs there is an LCD folder with a code chooser that uses a switch/case.

Thank you, this is what I was looking for.