传动系统#
Drive#
The Drive block is used to move the 123 Robot in the specified direction forever, until a new Drivetrain command is used, or the project is stopped.
This is a non-waiting block and allows any subsequent blocks to execute without delay.
驱动 [向前 v]
Select which direction for the 123 Robot to move in.

In this example, the 123 Robot will drive forward for 2 seconds, then stop.
当开始
驱动 [向前 v]
等待 (2) 秒
驱动停止
Drive For#
The Drive For block is used to move the 123 Robot for a given distance.
This is a waiting block and does not allow subsequent blocks to trigger until it is done.
驱动 [向前 v] (1) [步数 v]
Select which direction for the 123 Robot to move in.

Set how far the 123 Robot will move by entering a value, and choosing the unit of measurement (steps or millimeters).

In this example, the robot will drive forward for 2 steps.
当开始
驱动 [向前 v] (3) [步数 v]
Drive Until#
The Drive Until block is used to move the 123 Robot indefinitely until a specified condition is met.
This is a waiting block and does not allow subsequent blocks to trigger until it is done.
驱动 [向前 v] 直到 [对象 v]
Select which direction for the 123 Robot to move in.

Select which behavior to use:
object - An object is detected by the Eye Sensor on the front of the 123 Robot.
crash - The 123 Robot crashes into an object or wall.
line - The Line Detector Sensor detects a line underneath the 123 Robot.

In this example, the 123 Robot will drive until it crashes into a wall, then it will stop driving.
当开始
驱动 [向前 v] 直到 [撞毁 v]
驱动停止
Turn#
The Turn block is used to rotate the 123 Robot forever, until a new Drivetrain block is used, or the program is stopped.
This is a non-waiting block and allows any subsequent blocks to execute without delay.
[右 v] 转
Select which direction the 123 Robot will turn.

In this example, the 123 Robot will turn towards the right for 2 seconds, then stop.
当开始
驱动 [右 v]
等待 (2) 秒
驱动停止
Turn For#
The Turn For block is used to rotate the 123 Robot for a given number of degrees.
This is a waiting block and does not allow subsequent blocks to trigger until it is done.
[右 v] 转 (90) 度
Select which direction the 123 Robot will turn.

Set how far the 123 Robot will turn by entering the number of degrees.
In this example, the 123 Robot will turn left for 45 degrees.
当开始
[左 v] 转 (45) 度
Turn to Heading#
The Turn to Heading block is used to turn a 123 Robot to a specific heading using the built-in Gyro sensor.
This is a waiting block and does not allow subsequent blocks to trigger until it is done.
归位至 (90) 度
The Turn to Heading block turns to an absolute degree measure. This means:
When the 123 Robot turns clockwise past 360 degrees, the degree measure will start increasing again from 0 degrees.
When the 123 Robot turns counterclockwise past 0 degrees, the degree measure start decreasing again from 360 degrees.

In this example, the 123 Robot will turn to face 270 degrees.
当开始
归位至 (270) 度
Stop Driving#
The Stop Driving block is used to stop the 123 Robot from moving.
This is a non-waiting block and allows any subsequent blocks to execute without delay.
驱动停止
In this example, the 123 Robot will drive forward for 2 seconds, then stop.
当开始
驱动 [向前 v]
等待 (2) 秒
驱动停止
Set Drive Timeout#
The Set Drive Timeout block is used to set a time limit for Drivetrain movement commands.
This is a non-waiting block and allows any subsequent blocks to execute without delay.
设定驱动超时为 (1) 秒
The Drivetrain’s time limit is used to prevent Drivetrain blocks that do not reach their target position from waiting the execution of other blocks in the stack.
For instance, if a 123 Robot is unable to reach its target position because it encounters an obstacle like a wall, the Drivetrain block will continue running indefinitely. This would prevent any subsequent blocks in the stack from executing. By setting a time limit, the Drivetrain block will automatically stop after the specified duration, allowing the code to proceed to the next block even if the target position is not reached.
In this example, the Drivetrain is set to move forward for 15 steps with a timeout of 2 seconds. The 123 Robot won’t be able to reach the target position within 2 seconds, so the Drive block will automatically stop, and the robot will turn right by 90 degrees.
当开始
设定驱动超时为 (2) 秒
驱动 [向前 v] (15) [步数 v]
[右 v] 转 (90) 度
Set Drive Heading#
The Set Drive Heading block is used to set the Drivetrain’s Gyro Sensor’s heading value.
This is a non-waiting block and allows any subsequent blocks to execute without delay.
设定底盘归位至 (0) 度
The Set Drive Heading block can be used to set the Drivetrain’s position to any given heading. This block can be used to reset the orientation of the Drivetrain’s gyro when the heading is set to a value of 0.
In this example, the Drivetrain’s Gyro Sensor’s heading will be set to 90 degrees before the 123 Robot turns to a heading of 0 degrees.
当开始
设定底盘归位至 (90) 度
归位至 (0) 度