View unanswered posts | View active topics It is currently Sat Nov 28, 2015 1:52 am

Reply to topic  [ 3 posts ] 
switching between autonomous and RC 
Author Message

Joined: Sun Jul 10, 2011 3:34 pm
Posts: 30
Post switching between autonomous and RC
I am using VEX PIC. I am trying to figure out how to use RC and autonomous together.

I understand how to start in the RC mode and switch into autonomous mode by pressing a button on the remote, but does anybody know how I can at any point in the autonomous mode, press a button on the remote to go back into the RC mode?

I know you can do it with a sensor, but I want to have all control over the robot with the remote.


Mon Jul 30, 2012 10:08 am
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 716
Post Re: switching between autonomous and RC
It does depend on how you have your code set up, but generally you would have two functions; one for autonomous and one for remote control. Basically, if you have your autnomous controlled by a while loop (which is generally a timer-based loop, with the time value being however long you want the autonomous period to last) you can put a call to your remote control function in an if statement. Then, if the button you determine is pressed when the code gets to that part of the code, it will kick out of the autonomous 'while' loop and go into the remote control section of code.

I don't know what level of coding you are at (and I never assume code mastery) so here are a few links to get you started with while loops, functions, and remote control buttons.

Functions are under Sensing->Behaviors and Functions, Remote Control can be found under Remote Control->Buttons->Remote start: ... index.html

While loops can be found on our wiki:

Check out our Blog! And our Facebook page!
Need help? Take a look at our updated help documentation and the ROBOTC Forums.

Mon Jul 30, 2012 11:29 am

Joined: Sun Jul 10, 2011 3:34 pm
Posts: 30
Post Re: switching between autonomous and RC
Are you sure that pressing the button on the remote, while in autonomous mode can actually switch it back into the RC mode?
Also, the link for the tutorial was for the VEX NET controller for cortex. I have PIC and am using the 75mhz transmitter, but are will they still work?

I put the code below that I've been working on. It works getting it into the autonomous mode, I'm just not sure how I would get it back into the RC mode. I know you said if the button you determine is pressed when the code gets to that part of the code, it will kick out of the autonomous, but how exactly do I go about doing this? Is there a special function that keeps the robot autonomous, but still listens to the controller at all times? Thanks again for the help.

#pragma config(Sensor, in1, impossible, sensorTouch)
#pragma config(Sensor, in5, ultra, sensorSONAR, int1)
#pragma config(Motor, port1, , tmotorNormal, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

int randTime;

task main()

while(true)//use remote contorl to position robot in desired location
bIfiAutonomousMode=false;//RC mode turned ON
motor[port1]= vexRT[Ch3];
motor[port2]= vexRT[Ch2];

if(vexRT(Ch5)==127)//if the ch5 button on back of controller is pressed...goto auton
goto auton;
}//end if

}//end while


motor[port1]=40;//start driving autonomously until robot sees object between 0 and 10 inches


if(((SensorValue(ultra)<10)&&(SensorValue(ultra)>0)))//when robot sees something between 0 and 10 inches....
motor[port1]=-40;//......turn around for a random time between 0 and 2 seconds
randTime = random(2000);
goto again;
}//end if

}//end main

Tue Jul 31, 2012 8:58 am
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.