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.
<Controller [L1 v] 按下了?>
Parameter |
Description |
|---|---|
button |
Which button to check:
|
Example
当开始
[Drive forward while X is pressed.]
永久循环
如果 <Controller [R1 v] 按下了?> 那么
驱动 [向前 v]
否则
驱动停止
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.
(Controller [1 v] 位移)
Parameter |
Description |
|---|---|
axis |
Which axis to check:
|
Example
当开始
[Drive forward while the left joystick is pushed up.]
永久循环
如果 <(Controller [3 v] 位移) [math_greater_than v] [0]> 那么
驱动 [向前 v]
否则
驱动停止
Controller enable/disable#
The Controller enable/disable block enables or disables Controller configured actions from the Devices menu for all connected controllers.
控制器 [Disable v]
Parameter |
Description |
|---|---|
state |
What state to set the connected controller to:
|
当开始
[Disable controller configured actions until drive is done.]
控制器 [Disable v]
驱动 [向前 v] (6) [英寸 v] ▶
控制器 [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.]
如果 <(Controller [3 v] 位移) [math_greater_than v] [0]> 那么
驱动 [向前 v]
否则如果 <(Controller [3 v] 位移) [math_less_than v] [0]> 那么
驱动 [反 v]
否则
驱动停止