计时器#

介绍#

VEX GO 中的计时器允许您跟踪已用时间并根据时间间隔执行操作。通过多种时间管理方法,您可以在程序中创建精确且定时的操作。

以下是所有方法的列表:

方法——控制并与大脑的计时器互动。

  • 重置 – 将计时器重置为零。

  • 时间 – 返回项目开始以来经过的时间。

  • 事件 – 在指定的毫秒数后调用一个函数,并带有可选参数。

构造函数——创建额外的计时器。

  • 计时器 – 创建一个附加计时器。

重置#

reset sets the timer to zero.

Usage:
timer.reset()

参数

描述

该方法没有参数。

# Example coming soon

时间#

time returns the current elapsed time of the timer in the specified units — an integer for MSEC or a float for SECONDS.

Usage:
timer.time(units)

参数

描述

units

时间单位为毫秒 MSEC (默认)或 SECONDS

# Example coming soon

事件#

event calls a function after a specified amount of time.

Usage:
timer.event(callback, delay)

参数

描述

callback

当计时器事件发生时执行的函数。

delay

函数调用前的延迟,以毫秒为单位。

# Example coming soon

构造函数#

Timer#

Timer creates a new timer. A Timer object will immediately begin counting the moment it is created and will work with all timer methods.

Usage:
my_timer = Timer()

参数

描述

此构造函数没有参数。

# Example coming soon