Controller#
Introduction#
The VEX AIR Drone Controller features 8 programmable buttons and 2 joysticks. These inputs allow the VEX AIR Drone to detect button presses and joystick movements, enabling interactive and responsive control.
Below is a list of all available methods:
Getters – Read button, joystick, and connection status.
.pressing – Returns whether the specified button is being pressed.
.position – Returns the position of the joystick’s specified axis.
is_drone_connected – Returns whether the VEX AIR Drone is connected.
get_battery_level – Returns the controller’s battery level as a percentage.
Callbacks – Respond to button or joystick input changes.
Getters#
.pressing#
.pressing
returns whether a specific button on the controller is currently being pressed. This method must be called on a specific button, such as button5
(see full list of buttons below). This will return either of the following:
True
- The specified button is being pressed.False
- The specified button is not being pressed.
Usage:
One of eight available buttons, numbered 5 through 12, can be used with this method, as shown below:
Button |
Command |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Parameters |
Description |
---|---|
This method has no parameters. |
# Example coming soon
.position#
.position
returns the position of the joystick’s specified axis as a percentage. This will return an integer from –100 to 100.
Usage:
One of four available axes can be used with this method, numbered 1 to 4.
Axis |
Command |
---|---|
|
|
|
|
|
|
|
|
Parameters |
Description |
---|---|
This method has no parameters. |
# Example coming soon
is_drone_connected#
is_drone_connected
returns whether the drone is connected. This will return a Boolean value:
True
- The drone is connected.False
- The drone is not connected.
Usage:
controller.is_drone_connected()
Parameters |
Description |
---|---|
This method has no parameters. |
# Example coming soon
get_battery_level#
get_battery_level
returns the Controller’s battery level as a percentage. This returns an integer from 0 to 100.
Usage:
controller.get_battery_level()
Parameters |
Description |
---|---|
This method has no parameters. |
# Example coming soon
Callbacks#
.pressed#
.pressed
registers a function to be called when a specific button on the controller is pressed. This method must be called on a specific button, such as button5
(see full list of buttons below).
Usage:
One of eight available buttons can be used with this method, numbered 5
to 12
.
Button |
Command |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Parameters |
Description |
---|---|
|
A function that is previously defined to execute when the specified button is being pressed. |
|
Optional. A tuple containing arguments to pass to the callback function. See Using Events with Parameters for more information. |
# Example coming soon
.released#
.released
registers a function to be called when a specific button on the controller is released. This method must be called on a specific button, such as button5
(see full list of buttons below).
Usage:
One of eight available buttons can be used with this method, numbered 5
to 12
.
Button |
Command |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Parameters |
Description |
---|---|
|
A function that is previously defined to execute when the specified button is released. |
|
Optional. A tuple containing arguments to pass to the callback function. See Using Functions with Parameters for more information. |
# Example coming soon
.changed#
.changed
registers a function to be called when the joystick’s position changes.
Usage:
One of four available axes can be used with this method, numbered 1
to 4
.
Axis |
Command |
---|---|
|
|
|
|
|
|
|
|
Parameters |
Description |
---|---|
|
A function that is previously defined to execute when the axis’ value changes. |
|
Optional. A tuple containing arguments to pass to the callback function. See Using Functions with Parameters for more information. |
# Example coming soon