Controller#
The EXP Controller allows users to control and customize behaviors for their robot or display messages on the Controller’s screen.
Below is a list of available blocks:
Controller pressed? – Returns whether a selected button is pressed.
Controller position – Returns a joystick’s position.
Controller enable/disable – Enables or disables Controller-configured actions.
when Controller button pressed – Runs the attached stack when a selected button is pressed or released.
when Controller axis is changed – Runs the attached stack when a joystick axis value changes.
Controller pressed?#
The Controller pressed? block returns a Boolean indicating whether a specific button on the controller is currently pressed.
True – The specified button on the controller is being pressed.
False – The specified button on the controller is not being pressed.
<¿Controlador [L1 v] presionado?>
Parameter |
Description |
|---|---|
button |
Which button to check:
|
Example
cuando empezó
[Drive forward while X is pressed.]
para siempre
si <¿Controlador [R1 v] presionado?> entonces
unidad [adelante v]
demás
deja de conducir
Controller position#
The Controller position block returns how far a joystick is moved along a specific axis from -100 to 100. A value of 0 means the joystick is centered.
(Posición [1 v] del controlador)
Parameter |
Description |
|---|---|
axis |
Which axis to check:
|
Example
cuando empezó
[Drive forward while the left joystick is pushed up.]
para siempre
si <(Posición [3 v] del controlador) [math_greater_than v] [0]> entonces
unidad [adelante v]
demás
deja de conducir
Controller enable/disable#
The Controller enable/disable block enables or disables Controller configured actions from the Devices menu for all connected controllers.
Controlador [Disable v]
Parameter |
Description |
|---|---|
state |
What state to set the connected controller to:
|
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 axis changed#
The when Controller axis changed block runs the attached stack of blocks whenever the value of a specified joystick axis changes.
when Controller axis [1 v] changed :: hat events
Parameter |
Description |
|---|---|
device |
Which controller to use, configured in the Devices window. |
axis |
Which axis to check:
|
Example
when Controller axis [3 v] changed :: hat events
[Move forward when left joystick is up, backwards if down.]
si <(Posición [3 v] del controlador) [math_greater_than v] [0]> entonces
unidad [adelante v]
de lo contrario si <(Posición [3 v] del controlador) [math_less_than v] [0]> entonces
unidad [atrás v]
demás
deja de conducir