定时器#
介绍#
The VEX V5’s Brain 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.
重置计时器
参数 |
描述 |
|---|---|
此代码块没有参数。 |
例子
当开始
[Display the time the robot takes to turn right.]
驱动 [向前 v] [200] [毫米 v] ▶
重置计时器
[右 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.
(计时器秒数)
参数 |
描述 |
|---|---|
此代码块没有参数。 |
例子
当开始
[Display the time after 2 seconds have passed.]
等到 <(计时器秒数) [math_greater_than_or_equal_to v] [2]>
在屏幕上打印 (计时器秒数)▶
当定时器#
The when timer hat block runs the attached stack of blocks after a specified amount of time.
当计时器> [1] 秒
参数 |
描述 |
|---|---|
时间 |
指定附加的块堆栈开始运行前的秒数。接受整数和小数。 |
例子
当计时器> [2] 秒
[Display a message after 2 seconds.]
在屏幕上打印 [Time's up!]▶