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 how long something takes, trigger events after a set time, or reset for new timing operations.

Below is a list of all available blocks:

reset timer#

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.

The reset timer stack block.#
  reset timer

Parameters

Description

This block has no parameters.

Example

  when started
  [Display the time the drone takes to climb upwards.]
  take off to [500] [mm v] ▶
  reset timer
  climb [up v] for [500] [mm v] ▶
  print [Time elapsed:] on screen ▶
  print (timer in seconds) on screen ▶

timer in 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 drone to complete different actions.

The timer in seconds reporter block.#
  (timer in seconds)

Parameters

Description

This block has no parameters.

Example

  when started
  [Play a sound after 4 seconds.]
  wait until < (timer in seconds) [math_greater_than_or_equal_to v] [4] >
  print (timer in seconds) on screen ▶
  play sound [success v] ▶

when timer#

The when timer hat block runs the attached stack of blocks after a specified amount of time.

The when timer hat block.#
  when timer > [1] seconds

Parameters

Description

time

Specifies the number of seconds before the attached stack of blocks starts. Accepts both whole and decimal numbers.

Example

  when timer > [4] seconds
  [Play a sound after 4 seconds.]
  print (timer in seconds) on screen ▶
  play sound [success v] ▶