Programming instructions
Reference
Project Lead The Way
©
and Carnegie Mellon Robotics Academy
©
/ For use with VEX
®
Robotics Systems
Reserved Words • 4
Reserved Words
bVexAutonomousMode = false; //enable radio control
while(true)
{
motor[port3] = vexRT[Ch3]; //right joystick, y-axis
//controls the motor on port 3
motor[port2] = vexRT[Ch2]; //left joystick, y-axis
//controls the motor on port 2
}
Radio Control
ROBOTC allows you to control your robot using input from the Radio Control Transmitter.
bVexAutonomousMode
Set the value to either 0 for radio enabled or 1 for radio disabled (autonomous mode). You can
also use “true” for 1 and “false” for 0.
Control Port Joystick Channel Possible Values
Right Joystick, X-axis Ch1 -127 to 127
Right Joystick, Y-axis Ch2 -127 to 127
Left Joystick, Y-axis Ch3 -127 to 127
Left Joystick, X-axis Ch4 -127 to 127
Left Rear Buttons Ch5 -127, 0, or 127
Right Rear Buttons Ch6 -127, 0, or 127
Control Port Joystick Channel Possible Values
Right Joystick, X-axis Ch1Xmtr2 -127 to 127
Right Joystick, Y-axis Ch2Xmtr2 -127 to 127
Left Joystick, Y-axis Ch3Xmtr2 -127 to 127
Left Joystick, X-axis Ch4Xmtr2 -127 to 127
Left Rear Buttons Ch5Xmtr2 -127, 0, or 127
Right Rear Buttons Ch6Xmtr2 -127, 0, or 127
If the RF receiver is plugged into Rx 2, the following values apply:
vexRT[joystick_channel]
This command retrieves the value of the specied channel being transmitted.
If the RF receiver is plugged into Rx 1, the following values apply:
bVexAutonomousMode = 0; //enable radio control
bVexAutonomousMode = 1; //disable radio control
Go to Reference Links