Controller#
The V5 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:
Values – Read button states and joystick positions.
Controller pressed? – Returns whether a selected button is pressed.
Controller position – Returns a joystick’s position.
Actions – Rumble the controller and enable or disable configured Controller functions.
play rumble – Plays a rumble pattern on the Controller.
Controller enable/disable – Enables or disables Controller-configured actions.
Events – Run code when a button is pressed or joystick is moved.
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.
Screen – Display text and numbers on the Controller’s screen.
print on Controller – Prints text and numbers to the Controller’s screen.
set cursor on Controller – Moves the cursor to the next row.
set cursor to next row on Controller – Moves the cursor to the next line.
set print precision on Controller – Sets decimal places for printed numbers.
clear Controller – Clears the Controller screen.
clear row on Controller – Clears a single row on the Controller screen.
Values#
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 1 v] [▲ v] 按下?>
Parameter |
Description |
|---|---|
device |
Which controller to use, configured in the Devices window. |
button |
Which button to check:
|
Example
当开始
[Drive forward while X is pressed.]
永久循环
如果 <[Controller 1 v] [X 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.
([Controller1 v] [1 v] position)
Parameter |
Description |
|---|---|
device |
Which controller to use, configured in the Devices window. |
axis |
Which axis to check:
|
Example
当开始
[Drive forward while the left joystick is pushed up.]
永久循环
如果 <([Controller1 v] [3 v] position) [math_greater_than v] [0]> 那么
驱动 [向前 v]
否则
驱动停止
Actions#
play rumble#
The play rumble block plays a rumble pattern on the Controller.
[Long v] 播放 [Controller 1 v] 振动
Parameter |
Description |
|---|---|
pattern |
The rumble pattern to play on the controller:
|
device |
Which controller to use, configured in the Devices window. |
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 controllers to:
|
当开始
[Disable controller configured actions until drive is done.]
控制器 [Disable v]
驱动 [向前 v] (6) [英寸 v] ▶
控制器 [Enable v]
Events#
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 [Controller1 v] 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 [Controller1 v] axis [3 v] changed :: hat events
[Move forward when left joystick is up, backwards if down.]
如果 <([Controller1 v] [3 v] position) [math_greater_than v] [0]> 那么
驱动 [向前 v]
否则如果 <([Controller1 v] [3 v] position) [math_less_than v] [0]> 那么
驱动 [反 v]
否则
驱动停止
Screen#
The V5 Controller has access to 3 rows and 19 columns to print on.

print on Controller#
The print on Controller block prints text and numbers to the Controller’s screen.
在 [VEXcode] ▶上打印 [Controller 1 v]
Parameter |
Description |
|---|---|
value |
The text, number, or variable value to display. |
device |
Which controller to use, configured in the Devices window. |
expanding arrow |
Expand the block to read and set cursor to next row and make the cursor move to the next row after this block. |
Example
当开始
[Display a message on the Controller.]
在 [Hello!] ▶上打印 [Controller 1 v]
set cursor on Controller#
The set cursor on Controller block sets the cursor to a specific row and column on the controller’s screen. The controller screen has 3 rows and 19 columns.

在 [1] 设定光标至 [1] 行 [Controller 1 v] 列
Parameter |
Description |
|---|---|
row |
The row of the cursor from 1 to 3. |
column |
The column of the cursor from 1 to 19. |
device |
Which controller to use, configured in the Devices window. |
Example
当开始
[Clear the screen to prepare for printing.]
clear [Controller1 v]
在 [1] 设定光标至 [1] 行 [Controller 1 v] 列
在 [Hello!] ▶上打印 [Controller 1 v]
set cursor to next row on Controller#
The set cursor to next row on Controller block sets the cursor to the next row on the controller’s screen.
设定 [Controller 1 v] 光标至下一行
Parameter |
Description |
|---|---|
device |
Which controller to use, configured in the Devices window. |
Example
当开始
[Clear the screen to prepare for printing.]
clear [Controller1 v]
在 [1] 设定光标至 [1] 行 [Controller 1 v] 列
在 [Row 1] ▶上打印 [Controller 1 v]
设定 [Controller 1 v] 光标至下一行
在 [Row 2] ▶上打印 [Controller 1 v]
set print precision on Controller#
The set print precision on Controller block sets how many decimal places are shown when printing numbers on the controller’s screen.
将打印精度设置为 [1 v] 到 [Controller 1 v]
Parameter |
Description |
|---|---|
precision |
How many decimals will be shown when numbers are printed:
|
device |
Which controller to use, configured in the Devices window. |
Example
当开始
[Display division with two decimals.]
将打印精度设置为 [0.01 v] 到 [Controller 1 v]
在 ([1] [math_division v] [3]) ▶上打印 [Controller 1 v]
clear Controller#
The clear Controller block clears the Controller’s screen.
clear [Controller1 v]
Parameter |
Description |
|---|---|
device |
Which controller to use, configured in the Devices window. |
Example
当开始
[Clear the screen to prepare for printing.]
clear [Controller1 v]
在 [1] 设定光标至 [1] 行 [Controller 1 v] 列
在 [Hello!] ▶上打印 [Controller 1 v]
clear row on Controller#
The clear row on Controller block clears a specified row on the Controller’s screen.
清除 [1] 第 [Controller 1 v] 行
Parameter |
Description |
|---|---|
row |
Which row to clear from 1 to 3. |
device |
Which controller to use, configured in the Devices window. |
Example
当开始
[Clear only one row on the controller.]
clear [Controller1 v]
在 [1] 设定光标至 [1] 行 [Controller 1 v] 列
在 [I will go!] ▶上打印 [Controller 1 v]
设定 [Controller 1 v] 光标至下一行
在 [I will stay!] ▶上打印 [Controller 1 v]
等待 [2] 秒
清除 [1] 第 [Controller 1 v] 行