NXT Functions Joystick Control
From ROBOTC API Guide
NXT → Functions and Variables → Joystick Control
| For information about Joystick Control and the NXT, as well as a setup tutorial, please see the article: NXT: Using Joysticks. |
|
| |||||||
getJoystickSettings
| Before you can use the joystick variables, you have to "update" the variables by getting the newest packet of data from the joysticks. Because the joystick station may only send updates every 50-100ms, you should update your joystick values as often as possible to get the most up to date joystick data. To "update" your joystick variables, use this function. | |
|
Controller 1
joy1_Buttons
| TPCJoystick joy1_Buttons | |
| (TPCJoystick) Returns a "Bit Map" for the 12 buttons on Controller #1. For more information on how to use buttons to control actions, See the "Using Buttons" help section. | |
|
joy1_TopHat
| TPCJoystick joy1_TopHat | |
| (TPCJoystick) Returns the value of the direction pad (or "Top Hat") on Controller #1. A value of -1 is returned when nothing is pressed, and a value of 0 to 7 for selected "octant" when pressed. | |
|
joy1_x1
| TPCJoystick joy1_x1 | |
| (TPCJoystick) Value of the X Axis on the Left Joystick on Controller #1. Ranges in values between -128 to +127. | |
|
joy1_y1
| TPCJoystick joy1_y1 | |
| (TPCJoystick) Value of the Y Axis on the Left Joystick on Controller #1. Ranges in values between -128 to +127. | |
|
joy1_x2
| TPCJoystick joy1_x2 | |
| (TPCJoystick) Value of the X Axis on the Right Joystick on Controller #1. Ranges in values between -128 to +127. | |
|
joy1_y2
| TPCJoystick joy1_y2 | |
| (TPCJoystick) Value of the Y Axis on the Right Joystick on Controller #1. Ranges in values between -128 to +127. | |
|
Controller 2
joy2_Buttons
| TPCJoystick joy2_Buttons | |
| (TPCJoystick) Returns a "Bit Map" for the 12 buttons on Controller #2. For more information on how to use buttons to control actions, See the "Using Buttons" help section. | |
|
joy2_TopHat
| TPCJoystick joy2_TopHat | |
| (TPCJoystick) Returns the value of the direction pad (or "Top Hat") on Controller #2. A value of -1 is returned when nothing is pressed, and a value of 0 to 7 for selected "octant" when pressed. | |
|
joy2_x1
| TPCJoystick joy2_x1 | |
| (TPCJoystick) Value of the X Axis on the Left Joystick on Controller #2. Ranges in values between -128 to +127. | |
|
joy2_y1
| TPCJoystick joy2_y1 | |
| (TPCJoystick) Value of the Y Axis on the Left Joystick on Controller #2. Ranges in values between -128 to +127. | |
|
joy2_x2
| TPCJoystick joy2_x2 | |
| (TPCJoystick) Value of the X Axis on the Right Joystick on Controller #2. Ranges in values between -128 to +127. | |
|
joy2_y2
| TPCJoystick joy2_y2 | |
| (TPCJoystick) Value of the Y Axis on the Right Joystick on Controller #2. Ranges in values between -128 to +127. | |
|