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?#

The controller button pressed block returns if a controller button is being pressed.

  • True – The specified button is being pressed.

  • False – The specified button is not being pressed.

The Controller button pressed Boolean block.#
    <controller button [5 v] pressed?>

A VEX AIR Controller is facing backward with its 8 orange buttons highlighted yellow.

Parameters

Description

button

The button to check if it has been pressed, ranging from 5 to 12.

Example

Example coming soon!

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.

The Controller axis position reporter block.#
    (controller axis [1 v] position)

A VEX AIR Controller is facing forward with the joystick axes bordered by red boxes.

Parameters

Description

axis

The axis to return the position of:

  • 1 - The left joystick vertical axis.
  • 2 - The left joystick horizontal axis.
  • 3 - The right joystick horizontal axis.
  • 4 - The right joystick vertical axis.

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.

The Controller axis position reporter block.#
    <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.

The Controller axis position reporter block.#
    (controller battery level in %)

Parameters

Description

This block has no parameters.

Example

Example coming soon!

when controller button#

The when controller button block activates the attached stack of blocks when the button is being pressed or released.

The When Controller button hat block.#
    when controller button [5 v] [pressed v] :: hat events

A VEX AIR Controller is facing backward with its 8 orange buttons highlighted yellow.

Parameters

Description

button

The button to check if it has been pressed, ranging from 5 to 12.

button status

Specifies whether to trigger the attached stack of blocks when the button is:

  • pressed
  • released

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.

The When Controller axis is changed hat block.#
    when controller axis [1 v] is changed :: hat events

A VEX AIR Controller is facing forward with the joystick axes bordered by red boxes.

Parameters

Description

axis

The axis to report the position of:

  • 1 - The left joystick vertical axis.
  • 2 - The left joystick horizontal axis.
  • 3 - The right joystick horizontal axis.
  • 4 - The right joystick vertical axis.

Example

Example coming soon!