Robot-Specific Blocks#
Introduction#
The V5RC 23-24 Over Under Playground features blocks exclusive to the build designed for this Playground, including two motor options, Optical Sensor, Rotation Sensor, and Game Positioning System (GPS) Sensor.
All standard VEXcode VR Blocks are available for use in the V5RC 23-24 Over Under Playground.
Below is a list of all available Playground-specific Blocks:
Motion – Move and track the robot’s motors.
Actions
spin motor – Spins the selected motor or motor group indefinitely.
spin motor for – Spins a motor or group for a specific distance in degrees or turns.
spin motor to position – Spins a motor or motor group to a set position.
stop motor – Stops a specific motor or motor group from spinning.
Settings
set motor velocity – Sets the speed of a motor or motor group as a percentage.
set motor timeout – Limits how long a motor block waits before giving up if movement is blocked.
Position
motor position – Returns the motor’s current rotational position in degrees or turns.
set motor position – Sets the encoder value of a motor or motor group.
Values
motor is done? – Returns a Boolean indicating whether the motor is no longer spinning.
motor is spinning? – Returns a Boolean indicating whether the motor is currently spinning.
motor velocity – Returns the motor’s current velocity in %.
Sensing – Utilize the robot’s various sensors.
Optical
Optical found an object? – Returns whether an object is detected.
Optical detects color? – Returns whether a specific color is detected.
Optical brightness – Returns brightness in %.
Optical hue – Returns hue of the detected color.
when Optical – Executes attached blocks when the Optical Sensor detects or loses an object.
Rotation
set Rotation Sensor position – Sets the current position of the Rotation Sensor to a specific value.
Rotation Sensor angle – Returns the current angle of the sensor between 0 and 359.99 degrees.
Rotation Sensor position – Returns the total rotational position in degrees or turns.
GPS
GPS position – Returns the X or Y position from the GPS Sensor.
GPS heading – Returns the heading the robot is currently facing.
The examples on this page use the default Playground start position.
Motion#
Actions#
spin motor#
The spin motor block spins a selected motor or motor group in a specified direction using the current motor velocity.
spin [ArmMotor v] [down v]
Parameters |
Description |
|---|---|
motor |
The motor group to spin:
|
direction |
The direction to spin:
|
Example
当开始
[Spin the intake forward and then stop.]
spin [IntakeMotor v] [intake v]
等待 (1) 秒
stop [IntakeMotor v]
spin motor for#
The spin motor for block spins a selected motor or motor group for a specific amount of rotation using the current motor velocity, measured in degrees or turns.
spin [ArmMotor v] [up v] for (90) [degrees v] ▶
Parameters |
Description |
|---|---|
motor |
The motor group to spin:
|
direction |
The direction to spin:
|
distance |
The rotation amount, as an integer or decimal. |
unit |
The unit of measurement representing the distance:
|
expanding arrow |
By default, this is a waiting block, so the motor will finish moving before running the next block. To make the motor start moving and immediately run the next block right away, expand the block to say and don’t wait. |
Example
当开始
[Spin the intake forward and then stop.]
spin [IntakeMotor v] [intake v] for [1] [turns v] ▶
spin motor to position#
The spin motor to position block spins a motor or motor group to a specific absolute position using the current motor velocity and motor position.
[ArmMotor v] 转至 (90) [度 v] ▶
Parameters |
Description |
|---|---|
motor |
The motor group to spin:
|
position |
The target position to spin the motor group to. |
unit |
The unit of measurement:
|
expanding arrow |
By default, this is a waiting block, so the motor will finish moving before running the next block. To make the motor start moving and immediately run the next block right away, expand the block to say and don’t wait. |
Example
当开始
[Spin the intake forward and then stop.]
spin [IntakeMotor v] to position [270] [degrees v] ▶
stop motor#
The stop motor block immediately stops the selected motor or motor group.
[ArmMotor v] 停止
Parameters |
Description |
|---|---|
motor |
The motor group to stop:
|
Example
当开始
[Spin the intake forward and then stop.]
spin [IntakeMotor v] [intake v]
等待 (1) 秒
stop [IntakeMotor v]
Settings#
set motor velocity#
The set motor velocity block sets the default spinning speed of a motor or motor group as a percentage for all subsequent Motor blocks in the project.
set [ArmMotor v] velocity to [50] [% v]
Parameters |
Description |
|---|---|
motor |
The motor group to set the velocity of:
|
velocity |
Sets the default movement velocity from 0 to 100 as a percent. |
unit |
The unit that represents the velocity:
|
Example
当开始
[Spin the intake forward and then stop.]
set [IntakeMotor v] velocity to [75] [% v]
spin [IntakeMotor v] [intake v] for [1] [turns v] ▶
set motor timeout#
The set motor timeout block sets a time limit for how long a Motor block will wait to reach its target. If the robot cannot complete the movement within the set time, it will stop automatically and continue with the next block.
Note: The Motor’s time limit is used to prevent Motor blocks that do not reach their target position from stopping the execution of other blocks in the stack.
设定 [ArmMotor v] 超时为 [1] 秒
Parameters |
Description |
|---|---|
motor |
The motor group to set the timeout of:
|
time |
The maximum number of seconds a Motor block will run before stopping and moving to the next block. |
Example
当开始
[Spin the intake forward and then stop.]
set [IntakeMotor v] timeout to [2] seconds
spin [IntakeMotor v] [outtake v] for [3] [turns v] ▶
Position#
motor position#
The motor position block returns the total distance the selected motor or motor group has rotated.
([ArmMotor v] position in [degrees v])
Parameters |
Description |
|---|---|
motor |
The motor group to return the position of:
|
unit |
The unit of measurement:
|
set motor position#
The set motor position block sets a specific position value to a motor or motor group, which updates the encoder reading.
设定 [ArmMotor v] 转位至 (0) [度 v]
Parameters |
Description |
|---|---|
motor |
The motor group to set the position of:
|
position |
The encoder position value to set. |
unit |
The unit of measurement:
|
Example
当开始
[Spin the intake forward and then stop.]
set [IntakeMotor v] position to [90] [degrees v]
spin [IntakeMotor v] to position [0] [degrees v] ▶
Values#
motor is done#
The motor is done? block returns a Boolean indicating whether the motor or motor group is not spinning.
True – The motor is not spinning.
False – The motor is spinning.
<[ArmMotor v] 已结束?>
Parameters |
Description |
|---|---|
motor |
The motor group to check if it isn’t spinning:
|
motor is spinning?#
The motor is spinning? block returns a Boolean indicating whether the motor is spinning.
True – The motor is spinning.
False – The motor is not spinning.
<[ArmMotor v] 正在转?>
Parameters |
Description |
|---|---|
motor |
The motor group to check if it is spinning:
|
Example
当开始
[Take a triball into the Intake.]
spin [IntakeMotor v] [intake v] for [90] [degrees v] ◀ and don't wait
while <[IntakeMotor v] is spinning?>
spin [ArmMotor v] to position [1000] [degrees v] ◀ and don't wait
结束
motor velocity#
The motor velocity block returns the current rotational speed of the motor or motor group in a range from -100% to 100%.
([ArmMotor v] velocity in [% v] :: custom-motion)
Parameters |
Description |
|---|---|
motor |
The motor group to return the velocity of:
|
unit |
The unit that represents the velocity:
|
Sensing#
Optical#
Optical found an object?#
The Optical found an object? block returns a Boolean indicating whether the Optical Sensor has detected an object.
True – The Optical Sensor has detected an object.
False – The Optical Sensor has not detected an object.
<[Optical v] found an object?>
Parameters |
Description |
|---|---|
This block has no parameters. |
Optical detects color?#
The Optical detects color? block returns a Boolean indicating whether the Optical Sensor has detected a specific color.
True – The Optical Sensor has detected the specified color.
False – The Optical Sensor has not detected the specified color.
<[Optical v] detects [red v]?>
Parameters |
Description |
|---|---|
color |
Which color to check for:
|
Optical brightness#
The Optical brightness block returns the amount of light detected by the Optical Sensor in a range from 0% to 100%.
([Optical v] brightness in %)
Parameters |
Description |
|---|---|
This block has no parameters. |
Optical hue#
The Optical hue block returns the hue value of the color detected by the Optical Sensor.
Hue values range from 0 to 359 degrees, corresponding to positions on the color wheel shown below.

([Optical v] hue in degrees)
Parameters |
Description |
|---|---|
This block has no parameters. |
when Optical#
The when Optical block runs its stack when the Optical Sensor detects or loses an object. You can have multiple when Optical blocks to run multiple stacks of blocks at once.
when [Optical v] [detects v] an object
Parameters |
Description |
|---|---|
action |
Which action to trigger the hat block:
|
Rotation#
set Rotation Sensor position#
The set Rotation Sensor position block sets the current position of the Rotation Sensor to a value in degrees.
set [Rotation v] position to [0] degrees
Parameters |
Description |
|---|---|
position |
The position to set the Rotation Sensor to. |
Rotation Sensor angle#
The Rotation Sensor angle block returns the current angle of the sensor between 0 and 359.99 degrees.
([Rotation v] angle in degrees)
Parameters |
Description |
|---|---|
This block has no parameters. |
Rotation Sensor position#
The Rotation Sensor position block returns the total rotational position in degrees or turns.
([Rotation v] position in [degrees v] :: custom-sensing)
Parameters |
Description |
|---|---|
units |
The unit of measurement:
|
GPS#
GPS position#
The GPS position block returns the positional offset of the robot’s turning reference point from the center of a field with the GPS (Game Positioning System™) Sensor.
([GPS v] position [X v] in [mm v])
Parameters |
Description |
|---|---|
axis |
Which axis to report:
|
units |
The unit to represent the position:
|
GPS heading#
The GPS heading block returns the heading that the robot is currently facing based on the GPS (Game Positioning System™) Sensor’s readings from the VEX GPS Field Code from 0.00 to 359.99 degrees.
([GPS v] heading in degrees)
Parameters |
Description |
|---|---|
This block has no parameters. |