Controller#
Introduction#
The VEX AIR Controller features a 4-button layout and a joystick that functions as both an analog input and a pressable button. These inputs allow the Hornet to detect button presses and joystick movements, enabling interactive and responsive control.
Below is a list of all available blocks:
controller button pressed? – Checks if a specific button is currently being pressed.
controller axis position – Returns the position of the joystick along a specified axis.
controller is connected? - Returns whether or not the controller is connected to the Hornet.
controller battery level - Returns the controller’s battery level.
when controller button – Runs a stack of blocks when a button is pressed or released.
when controller axis is changed – Runs a stack of blocks when the joystick position changes.
controller axis position#
The controller axis position block returns the position of the specified joystick axis as a percentage. This returns an integer from –100 to 100.
(controller axis [1 v] position)
Parameters |
Description |
---|---|
axis |
The axis to return the position of:
|
Example
Example coming soon!
controller is connected?#
The controller is connected? block returns if the controller is connected to the Hornet. This block returns a Boolean value:
True – The controller is connected.
False – The controller is not connected.
<controller is connected to drone?>
Parameters |
Description |
---|---|
This block has no parameters. |
Example
Example coming soon!
controller battery level#
The controller is connected? block returns the battery level of the controller in percent.
(controller battery level in %)
Parameters |
Description |
---|---|
This block has no parameters. |
Example
Example coming soon!
when controller axis is changed#
The when controller axis is changed block activates the attached stack of blocks when the specified axis is being changed.
when controller axis [1 v] is changed :: hat events
Parameters |
Description |
---|---|
axis |
The axis to report the position of:
|
Example
Example coming soon!