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

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.

The front and top side of the EXP Controller with the joysticks, arrow buttons, and action buttons highlighted in yellow. On the surface of the controller are two joysticks on the left and right, with up and down arrow buttons on the left and A and B buttons on the right. On the top of the controller are L1 and L2 on the left side and R1 and R2 on the right side.
<Controller [L1 v] pressed?>

Parameter

Description

button

Which button to check:

  • L1
  • L2
  • L3
  • R1
  • R2
  • R3
  • A
  • B

Example

  when started
  [Drive forward while X is pressed.]
  forever
  if <Controller [R1 v] pressed?> then
  drive [forward v]
  else
  stop driving

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.

The front side of the EXP Controller with the joystick axis numbers highlighted in red. On the surface of the controller, the left joystick is labeled as Axis 4 for left and right movement and Axis 3 for up and down movement, while the right joystick is labeled as Axis 1 for left and right movement and Axis 2 for up and down movement.
  (Controller [1 v] position)

Parameter

Description

axis

Which axis to check:

  • 1
  • 2
  • 3
  • 4

Example

  when started
  [Drive forward while the left joystick is pushed up.]
  forever
  if <(Controller [3 v] position) [math_greater_than v] [0]> then
  drive [forward v]
  else
  stop driving

Controller enable/disable#

The Controller enable/disable block enables or disables Controller configured actions from the Devices menu for all connected controllers.

  Controller [Disable v]

Parameter

Description

state

What state to set the connected controller to:

  • Disable
  • Enable

    when started
    [Disable controller configured actions until drive is done.]
    Controller [Disable v]
    drive [forward v] for (6) [inches v] ▶
    Controller [Enable v]

when Controller button pressed#

The when Controller button pressed block runs the attached stack of blocks when a specified Controller button is pressed or released.

The front and top side of the EXP Controller with the joysticks, arrow buttons, and action buttons highlighted in yellow. On the surface of the controller are two joysticks on the left and right, with up and down arrow buttons on the left and A and B buttons on the right. On the top of the controller are L1 and L2 on the left side and R1 and R2 on the right side.
  when Controller button [L1 v] [pressed v] :: hat events

Parameter

Description

button

Which button to check:

  • L1
  • L2
  • L3
  • R1
  • R2
  • R3
  • A
  • B

state

When the attached stack of blocks will be run:

  • pressed
  • released

Example

  when Controller button [A v] [pressed v] :: hat events
  [Drive forward 50 mm whenever the A button is pressed]
  drive [forward v] for [200] [mm 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.

The front side of the EXP Controller with the joystick axis numbers highlighted in red. On the surface of the controller, the left joystick is labeled as Axis 4 for left and right movement and Axis 3 for up and down movement, while the right joystick is labeled as Axis 1 for left and right movement and Axis 2 for up and down movement.
  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:

  • 1
  • 2
  • 3
  • 4

Example

  when Controller axis [3 v] changed :: hat events
  [Move forward when left joystick is up, backwards if down.]
  if <(Controller [3 v] position) [math_greater_than v] [0]> then
  drive [forward v]
  else if <(Controller [3 v] position) [math_less_than v] [0]> then
  drive [reverse v]
  else
  stop driving