Controller#

Introduction#

The Controller category includes blocks for detecting and responding to input from the VEX IQ (1st gen) Controller. These blocks allow your robot to react to button presses, monitor joystick positions, and control how input mappings are applied during a project.

Below is a list of all blocks:

controller button pressed?#

The controller button pressed? block returns an integer indicating whether a specific controller button is being pressed.

  • 0 — The controller button is not being pressed.

  • 1 — The controller button is being pressed.

settings
<¿Controlador [E ▲ v] presionado?>

Parameters

Description

button

The button to check for a press or release:

  • E ▲
  • E ▼
  • F ▲
  • F ▼
  • L ▲
  • L ▼
  • R ▲
  • R ▼

Example

cuando empezó
[Move forward when the R ▲ button is pressed.]
para siempre
si <¿Controlador [R ▲ v] presionado?> entonces
unidad [adelante v]
demás
deja de conducir

controller axis position#

The controller axis position block returns the position of the joystick along a specified axis as an integer from -100 to 100.

settings
(Posición [A v] del controlador)

Parameters

Description

axis

The axis to check for change:

  • A
  • B
  • C
  • D

Example

cuando empezó
[Turn depending on the position of the right joystick.]
para siempre
si <(Posición [C v] del controlador) [math_less_than v] [0]> entonces
turno [izquierda v]
de lo contrario si <(Posición [C v] del controlador) [math_greater_than v] [0]> entonces
turno [derecha v]
demás
deja de conducir

controller enable/disable#

The controller enable/disable block enables or disables controller configured actions from the Devices menu.

Controlador [Disable v]

Parameters

Description

state

What state to set the controller to:

  • Disable
  • Enable

Example

cuando empezó
[Disable controller configured actions until drive is done.]
Controlador [Disable v]
unidad [adelante v] para (6) [pulgadas v] ▶
Controlador [Enable v]

when controller button#

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

settings
cuando el botón del controlador [E ▲ v] [presionado v]

Parameters

Description

button

The button to check for a press or release:

  • E ▲
  • E ▼
  • F ▲
  • F ▼
  • L ▲
  • L ▼
  • R ▲
  • R ▼

button status

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

  • pressed
  • released

Example

cuando el botón del controlador [R ▲ v] [presionado v]
[Turn when a button is pressed.]
girar [derecha v] por (90) grado ▶

when controller axis is changed#

The when controller axis is changed block activates the attached stack of blocks when the axis is being changed.

settings
Cuando se cambia el eje [A v] del controlador

Parameters

Description

axis

The axis to check for change:

  • A
  • B
  • C
  • D

Example

Cuando se cambia el eje [D v] del controlador
[Move forward when right joystick is moved.]
unidad [adelante v] para (200) [mm v] ▶