计时器#

介绍#

VEX GO 的“大脑”内置计时器,可追踪项目启动后已用时间。它可用于测量持续时间、在设定时间后触发事件,或重置以进行新的计时操作。

以下是所有可用块的列表:

重置定时器#

重置计时器块将计时器重置为零。

重置计时器堆栈块。#
重置计时器

参数

描述

该块没有参数。

例子

aria-description goes here#
当开始 :: hat events
[Build Used: Super Code Base 2.0]
[Reset the timer when the bumper is pressed.]
永久循环
清除所有行
打印 (计时器秒数) ▶
如果 <[bumper v] 按下了?> 那么
重置计时器 :: custom-orientation

计时器(以秒为单位)#

以秒为单位的计时器 块返回自上次重置计时器以来经过的时间,以秒为单位的小数。

以秒为单位的计时器报告块。#
(计时器秒数)

参数

描述

该块没有参数。

例子

aria-description goes here#
当开始 :: hat events
[Build Used: Super Code Base 2.0]
[Reset the timer when the bumper is pressed.]
永久循环
清除所有行
打印 (计时器秒数) ▶
如果 <[bumper v] 按下了?> 那么
重置计时器 :: custom-orientation

当计时器#

当计时器块在指定的时间后激活附加的块堆栈。

计时器帽子块。#
当计时器> [1] 秒

参数

描述

时间

指定附加的块堆栈启动前的秒数。接受整数和小数。

例子

aria-description goes here#
当计时器> [2] 秒 :: hat events
[Build Used: Code Base 2.0]
[Drive forward after 2 seconds.]
驱动 [向前 v] [100] [毫米 v] ▶