Robot-Specific Blocks#
Introduction#
The 123 Playspace Playground features blocks exclusive to the virtual 123 Robot, including blocks for the robot’s Drivetrain, LED, speaker, actions, Eye Sensor, and Gyro Sensor.
All standard VEXcode VR Blocks are available for use in the 123 Playspace Playground.
Below is a list of all available Playground-specific Blocks:
Drivetrain - Move and turn the robot.
Actions
drive - Drive the robot forward or in reverse continuously.
drive until - Drive the robot until a specified condition is met.
drive for - Drive the robot forward or in reverse for a specific distance.
turn - Turn the robot right or left continuously.
turn for - Turn the robot right or left for a specified amount of degrees.
turn to heading - Turn the robot to a specific heading.
stop driving - Stops all robot movement.
Settings
set drive timeout - Limits how long Drivetrain blocks wait to reach their goal.
set drive heading - Manually sets the robot’s heading value.
Values
drive is done? - Returns a Boolean indicating whether or not the robot is done driving.
drive heading - Returns the drivetrain’s heading in degrees.
Sound - Play built-in sounds through the 123 Robot’s speaker.
play sound - Plays one of the robot’s built-in sound effects.
LED - Control the 123 Robot’s center LED.
glow - Sets the color of the LED light.
Actions - Make the 123 Robot perform preset behaviors.
act - Acts out different emotions.
Sensing - Read values from the 123 Robot’s sensors.
Gyro
detected crash? - Returns a Boolean indicating whether or not a crash was detected.
Eye
eye found an object? - Returns whether the Eye Sensor detects an object.
eye detects color? - Returns whether the Eye Sensor detects a specific color.
eye hue - Return the hue value detected by the Eye Sensor.
eye bright object? - Returns a Boolean indicating if the detected object is bright.
eye brightness - Return the brightness detected by the Eye Sensor.
Drivetrain#
Actions#
drive#
The drive block moves the robot in the specified direction. This is a non-waiting block, meaning it runs continuously until another Drivetrain block interrupts it or the project stops.
驱动 [向前 v]
Parameters |
Description |
|---|---|
direction |
Drives the robot in one of the following directions:
|
Example
当开始
[Drive for 2 seconds.]
驱动 [向前 v]
等待 (2) 秒
驱动停止
drive until#
The drive until block is used to move the robot until a specified condition is met.
驱动 [向前 v] 直到 [对象 v]
Parameters |
Description |
|---|---|
direction |
Drives the robot in one of the following directions:
|
condition |
The condition that stops the robot:
|
Example
当开始
[Reverse after a crash.]
驱动 [向前 v] 直到 [撞毁 v]
驱动 [反 v] (1) [步数 v]
drive for#
The drive for block is used to move the robot for a specified distance.
驱动 [向前 v] (1) [步数 v]
Parameters |
Description |
|---|---|
direction |
Drives the robot in one of the following directions:
|
distance |
The distance, as an integer or decimal, that the robot will move, measured in units. |
unit |
The unit of measurement, which can be one of the following:
|
Example
当开始
[Drive back and forth.]
驱动 [向前 v] (3) [步数 v]
驱动 [反 v] (3) [步数 v]
turn#
The turn block turns the drivetrain continuously left or right. This is a non-waiting block, meaning the drivetrain will keep turning until another Drivetrain block runs or the project stops.
[右 v] 转
Parameters |
Description |
|---|---|
direction |
The direction the robot will turn:
|
Example
当开始
[Turn for 2 seconds.]
[右 v] 转
等待 (2) 秒
驱动停止
turn for#
The turn for block turns the drivetrain left or right for a specific number of degrees.
[右 v] 转 (90) 度
Parameters |
Description |
|---|---|
direction |
The direction the robot will turn:
|
angle |
The angle, as an integer or decimal, at which the robot turns, ranging from -360 to 360 degrees. |
Example
当开始
[Turn left, then turn around to the right.]
[左 v] 转 (90) 度
[右 v] 转 (180) 度
turn to heading#
The turn to heading block turns the drivetrain to face a specific heading.
归位至 (90) 度
Parameters |
Description |
|---|---|
heading |
The absolute heading the drivetrain will turn to, from -360 to 360 degrees. |
Example
当开始
[Turn to face the cardinal directions.]
归位至 (90) 度
等待 (2) 秒
归位至 (180) 度
等待 (2) 秒
归位至 (270) 度
等待 (2) 秒
归位至 (0) 度
等待 (2) 秒
stop driving#
The stop driving block immediately stops all movement of the drivetrain.
驱动停止
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
[Stop driving after 4 seconds.]
驱动 [向前 v]
等待 [4] 秒
驱动停止
Settings#
set drive timeout#
The set drive timeout block sets a time limit for how long a Drivetrain 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 Drivetrain’s time limit is used to prevent Drivetrain blocks that do not reach their target position from stopping the execution of other blocks in the stack.
设定驱动超时为 (1) 秒
Parameters |
Description |
|---|---|
time |
The maximum number of seconds a Drivetrain block will run before stopping and moving to the next block. |
Example
当开始
[Turn right after driving for 1 second.]
设定驱动超时为 (1) 秒
驱动 [向前 v] (1000) [毫米 v]
[右 v] 转 (90) 度
set drive heading#
The set drive heading block sets the robot’s current heading to a specified value.
设定底盘归位至 (0) 度
Parameters |
Description |
|---|---|
heading |
The heading value to assign, in degrees. |
Example
当开始
[Face the new 0 degree heading.]
设定底盘归位至 (90) 度
归位至 (0) 度
Values#
drive is done?#
The drive is done? block returns a Boolean indicating whether the drivetrain is not moving.
True - The drivetrain is not moving.
False - The drivetrain is moving.
Note: This block detects movement only when it is caused by the drive for, drive until, turn for, or turn to heading blocks.
<驱动已结束?>
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
[Glow blue after a crash.]
驱动 [向前 v] 直到 [撞毁 v]
永久循环
如果 <驱动已结束?> 那么
发光 [蓝色 v]
否则
发光 [绿色 v]
drive heading#
The drive heading block returns the drivetrain’s heading angle as a decimal number, in the range 0 to 359.99 degrees.
(底盘归位角度值)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
[Display the heading after turning.]
[右 v] 转 (450) 度
打印 (底盘归位角度值) ▶
Sound#
play sound#
The play sound block plays one of the robot’s built-in sounds.
播放声音 [鸣笛 v]
Parameters |
Description |
|---|---|
sound |
One of the built-in sounds shown below. |
Sound Name |
Play Sound |
|---|---|
honk |
|
doorbell |
|
crash |
|
random |
Plays a random sound from the 3 sounds above. |
Example
当开始 :: hat events
[Play the doorbell sound.]
播放声音 [门铃 v]
LED#
glow#
The glow block sets the color of the LED light.
发光 [绿色 v]
Parameters |
Description |
|---|---|
color |
The color to set the LED to:
|
Example
当开始 :: hat events
[Blink the LED light forever.]
永久循环
发光 [绿色 v]
等待 [0.5] 秒
发光 [灭 v]
等待 [0.5] 秒
Actions#
act#
The act block is used to act sad, happy, or crazy by having the 123 Robot perform a sequence of drive, turn, and sound behaviors.
表现 [难过 v]
Parameters |
Description |
|---|---|
emotion |
The emotion to act out.
|
当开始 :: hat events
[Act out a happy behavior.]
表现 [开心 v]
Sensing#
The virtual 123 Robot also has access to the standard Brain and Drivetrain Sensing blocks.
Gyro#
detected crash?#
The detected crash? block returns a Boolean indicating if the robot has come in contact with a wall or other object.
True - A crash was detected.
False - A crash was not detected.
<检测到碰撞?>
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
[Back up after a crash.]
驱动 [向前 v]
等到 <检测到碰撞?>
驱动 [反 v] (200) [毫米 v]
Eye#
eye found an object?#
The eye found an object? block returns a Boolean indicating whether or not the Eye Sensor detects an object within range.
True - The sensor has detected an object.
False - The sensor has not detected an object.
<辨色仪发现一个对象?>
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
[Stop driving after detecting an object.]
设定辨色仪灯 [on v]
驱动 [向前 v]
等待 (0.1) 秒
等到 <辨色仪发现一个对象?>
驱动停止
eye detects color?#
The eye detects color? block returns a Boolean indicating whether the Eye Sensor detects a specified color, based on the detected hue value.
True - The sensor detects the specified color.
False - The sensor does not detect the specified color.
<辨色仪测得 [红色 v]?>
Parameters |
Description |
|---|---|
color |
The color to detect:
|
Example
当开始
[Stop driving after detecting a green object.]
设定辨色仪灯 [on v]
驱动 [向前 v]
等待 (0.1) 秒
等到 <辨色仪测得 [绿色 v]?>
驱动停止
eye hue#
The eye hue block returns the hue value detected by the Eye Sensor in degrees from 0 to 359.

(辨色仪色度值)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
[Display if an object is pink.]
永久循环
清除所有行
如果 <[290] [math_less_than v] (辨色仪色度值) [math_less_than v] [350]> 那么
打印 [Pink!] ▶
等待 (0.1) 秒
否则
打印 [Not pink!] ▶
等待 (0.1) 秒
eye bright object?#
The eye bright object? block returns a Boolean indicating whether or not a detected object has a brightness value greater than 70%.
True - The detected object has a brightness value over 70%.
False - The detected object has a brightness value less than or equal to 70%.
<看到明亮对象?>
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
[Display whether a detected object is bright.]
设定辨色仪灯功率为 (100)%
驱动 [向前 v]
等到 <辨色仪发现一个对象?>
等待 (0.1) 秒
如果 <看到明亮对象?> 那么
打印 [Bright object!] ▶
否则
打印 [Object not bright.] ▶
eye brightness#
The eye brightness block returns the brightness detected by the Eye Sensor from 0% to 100%.
(辨色仪亮度百分比)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
当开始
[Display whether a detected object is bright.]
设定辨色仪灯功率为 (100)%
驱动 [向前 v]
等到 <辨色仪发现一个对象?>
等待 (0.1) 秒
如果 <(辨色仪亮度百分比) [math_less_than v] [70]> 那么
打印 [Object not bright.] ▶
否则
打印 [Bright object!] ▶