Opt out of Autonomous

If something goes wrong during my autonomous mode, is there a way to program a certain key combination on the transmitter to opt out of it and go to user control? Let’s say i want to use the key combo channel 5,6, and 3 >64 and want to jump to my User function called User. I don’t know much about switch statements, but i think would have to use those?

yes, i think what you are asking could be achieved. it may depend on how many of the 6 channels you plan to use on the controller. if you leave channel 5 open for programming, you can use the “rx input” block to get the value from that channel, 0, 127, or 255. using three while loops, you can change which mode you are in.

while (1)
 switch = RXinput(5);
 while (switch > 127)
  switch = RXinput(5);
  autonomous routine();
 while (switch < 127)
  switch = RXinput(5);
  operater control();

if you plan on using all 6 channels for control, than you will have to find a certain combination of the 6 which will never be used normally; you would have to intentionally press them to exit the routine.

you could also make (a) programming “flag(s)”, or a variable that is just an integer. when a certain button is pressed, the flag goes up. if the next number isn’t the right number in a combination, it goes back to 0. one the flag reaches a certain amount, you have the program start user controlled mode.

ok sweet, i’ll try that. thanks man!

How would you do program the flags?

pacos way is a lot simpler, so i’d just go with his.

but for the flags, just make an integer called flag and get inputs from the controller and send them to a variable received, do an if received equals a certain number, if it does set flag equal to one, and keep repeating this with different things for received to be equal to increasing flags value each time, but if its not the right number make it 0. its hard to explain, i might type it up in code for you later.

it’s not the big of a deal. sounds interesting, but also complicated. I’ll just go with paco’s way. Thanks anyway!

Question: will this exit out of the Autonomous Part if it’s stuck in a loop? I doubt it does, so kinda makes it meaningless… :confused:

Are you programming in EasyC or MPLAB???

You need to read the Vex Transmitters Buttons while looping through the autonomous code and force an exit of autonomous mode on your chosen button presses.

nope, because it enters a DIFFERENT while loop. the only way for it to go back to the original while is to exit the new loop.

using EasyC. to ‘read the vex transmitters Buttons while looping though the autonomous code’ in the while you write it as: GetRxInput (1,5) == 0 correct?
how do you FORCE an exit?

the while keeps repeating the initial if statement.
in this case, either
while (switch > 127)
while (switch < 127)

the only to exit this is to either make ‘switch’ less than 127 for the first one and greater than 127 for the second one.

to force it, you could just do an assignment, this as an example:
switch = 255;

“GetRxInput (1,5) == 0” would indicate the Bottom Button (IIRC) of
Chanel 5 being pressed.

“GetRxInput (1,5) == 127” would indicate neither button being pressed,
and “GetRxInput (1,5) == 255” would indicate the Top Button (IIRC) of
Chanel 5 being pressed. I might have Top and Bottom reversed. :wink:

A little checking of the Autonomous and Operator Control with Competition Template
on the Intelitek Site seems to reveal that the Vex Master Code keeps the Program Flow at the Autonomous for 20 Seconds and then the OperatorControl for a value of 254, which gives you 2 Minutes… Hmm, some clarification is needed here…

For an MPLAB example of this, take a look at my line tracker sample code here.

The program monitors the remote buttons which you can use to switch between autonomous line tracking mode and remote control mode. Also, if the line tracker gets sufficiently confused, it can give up and return the robot to remote control mode.


  • Dean