Timer#

Introduction#

The VEX AIR Drone Controller’s timer keeps track of elapsed time from the start of a project. It can be used to measure durations, trigger events after a set time, or reset for new timing operations. Below is a list of all available methods:

Action – Control the timer.

  • reset – Resets the timer to zero.

Getter – Report the current timer value.

  • time – Returns the elapsed time since the project started.

Callback – Trigger functions after a delay.

  • event – Calls a function after a specified number of milliseconds, with optional arguments.

Constructor - Create a Timer to track time.

  • Timer - Create a new timer object that can be used with these methods.

Action#

reset#

reset sets the timer to zero.

Usage:

timer.reset()

Parameters

Description

This method has no parameters.

# Example coming soon

Getter#

time#

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)

Parameters

Description

units

The time units are milliseconds MSEC (default) or SECONDS.

# Example coming soon

Callback#

event#

event calls a function after a specified amount of time.

Usage:

timer.event(callback, delay, arg)

Parameters

Description

callback

A function to execute when the timer event occurs.

delay

The delay before the function is called, in milliseconds.

arg

Optional. A tuple containing arguments to pass to the callback function. See Using Events with Parameters for more information.

# Example coming soon

Constructor#

Timer#

A new timer can be created using the Timer constructor. A new timer starts measuring time immediately when it is created.

Usage:
Timer()

Parameter

Description

This constructor has no parameters.

# Example coming soon