定时器#
介绍#
VEXcode VR has a timer that keeps track of elapsed time from the start of a project. It can be used to measure how long something takes, trigger events after a set time, or reset for new timing operations.
以下是所有可用模块的列表:
重置计时器 – 将计时器重置为零。
timer in seconds – Reports how much time has passed.
当定时器 – 在定时器超过指定时间后运行一个代码块栈。
重置计时器#
The reset timer stack block resets the timer to zero. This can be used to start timing a new part of a project without restarting the whole project.
重置计时器 :: custom-orientation
参数 |
描述 |
|---|---|
此代码块没有参数。 |
例子
当开始 :: hat events
[Display the time the robot takes to turn right.]
驱动 [向前 v] (200) [毫米 v] ▶
重置计时器 :: custom-orientation
[右 v] 转 (90) 度 ▶
设定打印精度为 [0.1 v]
打印 [Turn right took] ◀ 并设定光标为下一行
打印 (计时器秒数) ▶
打印 [ seconds] ▶
计时器(秒)#
The timer in seconds reporter block reports the time since the timer was last reset, as a decimal in seconds. The timer is automatically reset at the start of a project. This block can be used to time how long it takes the robot to complete different actions.
(计时器秒数)
参数 |
描述 |
|---|---|
此代码块没有参数。 |
例子
当开始 :: hat events
[Display the time it takes to move in a square.]
重复 (4)
驱动 [向前 v] (100) [毫米 v] ▶
[右 v] 转 (90) 度 ▶
结束
设定打印精度为 [0.01 v]
打印 (计时器秒数) ▶
当定时器#
The when timer hat block runs the attached stack of blocks after a specified amount of time.
当计时器> [1] 秒 :: hat events
参数 |
描述 |
|---|---|
时间 |
指定附加的块堆栈开始运行前的秒数。接受整数和小数。 |
例子
当计时器> [2] 秒 :: hat events
[Drive after 2 seconds.]
驱动 [向前 v] (200) [毫米 v] ▶