Timer#
Introduction#
VEXcode VR has a timer that 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 blocks:
reset timer – Resets the timer to zero.
timer in seconds – Returns the current elapsed time in seconds.
when timer – Runs a stack of blocks after the timer exceeds a specified time.
reset timer#
The reset timer block resets the timer to zero.
reiniciar el temporizador :: custom-orientation
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
cuando empezó :: hat events
[Display the time the robot takes to turn right.]
unidad [adelante v] para (200) [mm v] ▶
reiniciar el temporizador :: custom-orientation
girar [derecha v] por (90) grado ▶
establecer la precisión de impresión a [0.1 v]
imprimir [Turn right took] ◀ y coloque el cursor en la siguiente fila
imprimir (temporizador en segundos) ▶
imprimir [ seconds] ▶
timer in seconds#
The timer in seconds block returns the elapsed time since the timer was last reset, as a decimal in seconds.
(temporizador en segundos)
Parameters |
Description |
|---|---|
This block has no parameters. |
Example
cuando empezó :: hat events
[Display the time it takes to move in a square.]
repetir (4)
unidad [adelante v] para (100) [mm v] ▶
girar [derecha v] por (90) grado ▶
fin
establecer la precisión de impresión a [0.01 v]
imprimir (temporizador en segundos) ▶
when timer#
The when timer block activates the attached stack of blocks after a specified amount of time.
cuando el temporizador > [1] segundos :: hat events
Parameters |
Description |
|---|---|
time |
Specifies the number of seconds before the attached stack of blocks starts. Accepts both whole and decimal numbers. |
Example
cuando el temporizador > [2] segundos :: hat events
[Drive after 2 seconds.]
unidad [adelante v] para (200) [mm v] ▶