All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Reading Joystick values

Access to the joystick is done in a similar way to ROBOTC but with a few extensions.

vexControllerGet( tCtlIndex index )

index can either be an analog channel or button name, these are the definitions.

index joystick function
Ch1 Analog channel 1
Ch2 Analog channel 2
Ch3 Analog channel 3
Ch4 Analog channel 4
Btn5U Button 5 Up
Btn5D Button 5 Down
Btn6U Button 6 Up
Btn6D Button 6 Down
Btn7U Button 8 Up
Btn7D Button 8 Down
Btn7L Button 8 Left
Btn7R Button 8 Right
Btn8U Button 8 Up
Btn8D Button 8 Down
Btn8L Button 8 Left
Btn8R Button 8 Right
AcclX Accelerometer X axis
AcclY Accelerometer Y axis
AcclZ Accelerometer Z axis (not used)
Btn5 Btn5U or Btn5D
Btn6 Btn6U or Btn6D
Btn7 Btn7U or Btn7D or Btn7L or Btn8R
Btn8 Btn8U or Btn8D or Btn8L or Btn8R
BtnAny Any button

To access the second controller append Xmtr2 to any of the index names, eg. Btn8UXmtr2.

Buttons will return 1 (pressed) or 0 (not pressed).

Analog joystick values are in the range -127 to +127.