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? — Returns a Boolean indicating whether a button is currently pressed.
controller axis position — Returns the current joystick axis position.
controller enable/disable — Temporarily enables or disables controller actions.
when controller button — Runs a stack when a specific controller button is pressed or released.
when controller axis is changed — Runs a stack when a joystick axis is moved.
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.
(Controller [A v] 位移)
Parameters |
Description |
|---|---|
axis |
The axis to check for change:
|
Example
当开始
[Turn depending on the position of the right joystick.]
永久循环
如果 <(Controller [C v] 位移) [math_less_than v] [0]> 那么
[左 v] 转
否则如果 <(Controller [C 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.
控制器 [Disable v]
Parameters |
Description |
|---|---|
state |
What state to set the controller to:
|
Example
当开始
[Disable controller configured actions until drive is done.]
控制器 [Disable v]
驱动 [向前 v] (6) [英寸 v] ▶
控制器 [Enable v]
when controller axis is changed#
The when controller axis is changed block activates the attached stack of blocks when the axis is being changed.
当Controller [A v] 轴改变
Parameters |
Description |
|---|---|
axis |
The axis to check for change:
|
Example
当Controller [D v] 轴改变
[Move forward when right joystick is moved.]
驱动 [向前 v] (200) [毫米 v] ▶