vexRT
| const word vexRT[TVexJoysticks joystickOrButton]
|
| (word) Array that contains the values of the joysticks and buttons from a VEXnet Transmitter. Supports Joystick channels Ch1 through Ch4. Returns values between -127 and 127 (normalized for motor values in ROBOTC.)
As well as Buttons Btn5 through Btn8. Returns values of either 0 (not-pressed) or 1 (pressed).
|
| Parameter
|
Explanation
|
Data Type
|
| joystickOrButton
|
A joystick channel or button channel.
|
TVexJoysticks
|
|
while(true)
{
// Joystic Control:
motor[port2] = vexRT[Ch2]; //Motor port 2 speed is determined by Ch2 on the VEXnet Transmitter
motor[port3] = vexRT[Ch3]; //Motor port 3 speed is determined by Ch3 on the VEXnet Transmitter
// Button Control:
if(vexRT[Btn5U] == 1) //If button 5U is pressed:
{
motor[port5] = 32; //run motor port 5 at quarter speed (i.e. lift an arm)
}
else if(vexRT[Btn5D] == 1) //If button 5D is pressed:
{
motor[port5] = -32; //run motor port 5 at quarter speed reversed (i.e. lower an arm)
}
else //If neither buttons 5U or 5D are pressed:
{
motor[port5] = 0; //stop motor port 5 (i.e. don't move arm up or down)
}
}
|
|
Controller 1
AccelX
| TVexJoysticks AccelX
|
| (TVexJoysticks) The built-in accelerometer's X-axis.
|
while(true) // infinite loop:
{
motor[armMotor] = vexRT[AccelX]; // set the motor, 'armMotor' to the joystick-accelerometer's X-axis
}
|
|
AccelY
| TVexJoysticks AccelY
|
| (TVexJoysticks) The built-in accelerometer's Y-axis.
|
while(true) // infinite loop:
{
motor[armMotor] = vexRT[AccelY]; // set the motor, 'armMotor' to the joystick-accelerometer's Y-axis
}
|
|
AccelZ
| TVexJoysticks AccelZ
|
| (TVexJoysticks) The built-in accelerometer's Z-axis.
|
while(true) // infinite loop:
{
motor[armMotor] = vexRT[AccelZ]; // set the motor, 'armMotor' to the joystick-accelerometer's Z-axis
}
|
|
Btn5U
| TVexJoysticks Btn5U
|
| (TVexJoysticks) Button group 5 - "U" (up)
|
if(vexRT[Btn5U] == 1) // if Btn5U is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn5D
| TVexJoysticks Btn5D
|
| (TVexJoysticks) Button group 5 - "D" (down)
|
if(vexRT[Btn5D] == 1) // if Btn5D is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn6U
| TVexJoysticks Btn6U
|
| (TVexJoysticks) Button group 6 - "U" (up)
|
if(vexRT[Btn6U] == 1) // if Btn6U is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn6D
| TVexJoysticks Btn6D
|
| (TVexJoysticks) Button group 6 - "D" (down)
|
if(vexRT[Btn6D] == 1) // if Btn6D is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn7U
| TVexJoysticks Btn7U
|
| (TVexJoysticks) Button group 7 - "U" (up)
|
if(vexRT[Btn7U] == 1) // if Btn7U is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn7D
| TVexJoysticks Btn7D
|
| (TVexJoysticks) Button group 7 - "D" (down)
|
if(vexRT[Btn7D] == 1) // if Btn7D is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn7L
| TVexJoysticks Btn7L
|
| (TVexJoysticks) Button group 7 - "L" (left)
|
if(vexRT[Btn7L] == 1) // if Btn7L is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn7R
| TVexJoysticks Btn7R
|
| (TVexJoysticks) Button group 7 - "R" (right)
|
if(vexRT[Btn7R] == 1) // if Btn7R is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn8U
| TVexJoysticks Btn8U
|
| (TVexJoysticks) Button group 8 - "U" (up)
|
if(vexRT[Btn8U] == 1) // if Btn8U is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn8D
| TVexJoysticks Btn8D
|
| (TVexJoysticks) Button group 8 - "D" (down)
|
if(vexRT[Btn8D] == 1) // if Btn8D is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn8L
| TVexJoysticks Btn8L
|
| (TVexJoysticks) Button group 8 - "L" (left)
|
if(vexRT[Btn8L] == 1) // if Btn8L is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn8R
| TVexJoysticks Btn8R
|
| (TVexJoysticks) Button group 8 - "R" (right)
|
if(vexRT[Btn8R] == 1) // if Btn8R is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Ch1
| TVexJoysticks Ch1
|
| (TVexJoysticks) X-Axis - Right Joystick
|
while(true) // infinite loop:
{
motor[armMotor] = vexRT[Ch1]; // set the motor, 'armMotor' to the right joystick's X-axis
}
|
|
Ch2
| TVexJoysticks Ch2
|
| (TVexJoysticks) Y-Axis - Right Joystick
|
while(true) // infinite loop:
{
motor[armMotor] = vexRT[Ch2]; // set the motor, 'armMotor' to the right joystick's Y-axis
}
|
|
Ch3
| TVexJoysticks Ch3
|
| (TVexJoysticks) Y-Axis - Left Joystick
|
while(true) // infinite loop:
{
motor[armMotor] = vexRT[Ch3]; // set the motor, 'armMotor' to the left joystick's Y-axis
}
|
|
Ch4
| TVexJoysticks Ch4
|
| (TVexJoysticks) X-Axis - Left Joystick
|
while(true) // infinite loop:
{
motor[armMotor] = vexRT[Ch4]; // set the motor, 'armMotor' to the left joystick's X-axis
}
|
|
Controller 2
AccelXXmtr2
| TVexJoysticks AccelXXmtr2
|
| (TVexJoysticks) The built-in accelerometer's X-axis.
|
while(true) // infinite loop:
{
motor[armMotor] = vexRT[AccelXXmtr2]; // set the motor, 'armMotor' to the joystick-accelerometer's X-axis
}
|
|
AccelYXmtr2
| TVexJoysticks AccelYXmtr2
|
| (TVexJoysticks) The built-in accelerometer's Y-axis.
|
while(true) // infinite loop:
{
motor[armMotor] = vexRT[AccelYXmtr2]; // set the motor, 'armMotor' to the joystick-accelerometer's Y-axis
}
|
|
AccelZXmtr2
| TVexJoysticks AccelZXmtr2
|
| (TVexJoysticks) The built-in accelerometer's Z-axis.
|
while(true) // infinite loop:
{
motor[armMotor] = vexRT[AccelZXmtr2]; // set the motor, 'armMotor' to the joystick-accelerometer's Z-axis
}
|
|
Btn5UXmtr2
| TVexJoysticks Btn5UXmtr2
|
| (TVexJoysticks) Button group 5 - "U" (up)
|
if(vexRT[Btn5UXmtr2] == 1) // if Btn5UXmtr2 is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn5DXmtr2
| TVexJoysticks Btn5DXmtr2
|
| (TVexJoysticks) Button group 5 - "D" (down)
|
if(vexRT[Btn5DXmtr2] == 1) // if Btn5DXmtr2 is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn6UXmtr2
| TVexJoysticks Btn6UXmtr2
|
| (TVexJoysticks) Button group 6 - "U" (up)
|
if(vexRT[Btn6UXmtr2] == 1) // if Btn6UXmtr2 is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn6DXmtr2
| TVexJoysticks Btn6DXmtr2
|
| (TVexJoysticks) Button group 6 - "D" (down)
|
if(vexRT[Btn6DXmtr2] == 1) // if Btn6DXmtr2 is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn7UXmtr2
| TVexJoysticks Btn7UXmtr2
|
| (TVexJoysticks) Button group 7 - "U" (up)
|
if(vexRT[Btn7UXmtr2] == 1) // if Btn7UXmtr2 is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn7DXmtr2
| TVexJoysticks Btn7DXmtr2
|
| (TVexJoysticks) Button group 7 - "D" (down)
|
if(vexRT[Btn7DXmtr2] == 1) // if Btn7DXmtr2 is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn7LXmtr2
| TVexJoysticksBtn7LXmtr2
|
| (TVexJoysticks) Button group 7 - "L" (left)
|
if(vexRT[Btn7LXmtr2] == 1) // if Btn7LXmtr2 is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn7RXmtr2
| TVexJoysticks Btn7RXmtr2
|
| (TVexJoysticks) Button group 7 - "R" (right)
|
if(vexRT[Btn7RXmtr2] == 1) // if Btn7RXmtr2 is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn8UXmtr2
| TVexJoysticks Btn8UXmtr2
|
| (TVexJoysticks) Button group 8 - "U" (up)
|
if(vexRT[Btn8UXmtr2] == 1) // if Btn8UXmtr2 is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn8DXmtr2
| TVexJoysticks Btn8DXmtr2
|
| (TVexJoysticks) Button group 8 - "D" (down)
|
if(vexRT[Btn8DXmtr2] == 1) // if Btn8DXmtr2 is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn8LXmtr2
| TVexJoysticks Btn8LXmtr2
|
| (TVexJoysticks) Button group 8 - "L" (left)
|
if(vexRT[Btn8LXmtr2] == 1) // if Btn8LXmtr2 is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Btn8RXmtr2
| TVexJoysticks Btn8RXmtr2
|
| (TVexJoysticks) Button group 8 - "R" (right)
|
if(vexRT[Btn8RXmtr2] == 1) // if Btn8RXmtr2 is pressed:
{
motor[rightMotor] = 0; // stop 'rightMotor'
motor[leftMotor] = 0; // stop 'leftMotor'
}
|
|
Ch1Xmtr2
| TVexJoysticks Ch1Xmtr2
|
| (TVexJoysticks) X-Axis - Right Joystick
|
while(true) // infinite loop:
{
motor[armMotor] = vexRT[Ch1Xmtr2]; // set the motor, 'armMotor' to the right joystick's X-axis
}
|
|
Ch2Xmtr2
| TVexJoysticks Ch2Xmtr2
|
| (TVexJoysticks) Y-Axis - Right Joystick
|
while(true) // infinite loop:
{
motor[armMotor] = vexRT[Ch2Xmtr2]; // set the motor, 'armMotor' to the right joystick's Y-axis
}
|
|
Ch3Xmtr2
| TVexJoysticks Ch3Xmtr2
|
| (TVexJoysticks) Y-Axis - Left Joystick
|
while(true) // infinite loop:
{
motor[armMotor] = vexRT[Ch3Xmtr2]; // set the motor, 'armMotor' to the left joystick's Y-axis
}
|
|
Ch4Xmtr2
| TVexJoysticks Ch4Xmtr2
|
| (TVexJoysticks) X-Axis - Left Joystick
|
while(true) // infinite loop:
{
motor[armMotor] = vexRT[Ch4Xmtr2]; // set the motor, 'armMotor' to the left joystick's X-axis
}
|
|