Minutero#
Introducción#
El temporizador del VEX 123 permite controlar el tiempo transcurrido y realizar acciones en función de intervalos de tiempo. Se puede usar para medir la duración de una tarea o para reiniciarla y programar nuevas operaciones de temporización.
A continuación se muestra una lista de todos los métodos:
Métodos: Controlar e interactuar con el temporizador.
Constructor – Crea temporizadores adicionales.
Timer– Creates an additional timer.
reiniciar#
reset sets the timer to zero. This can be used to time additional sections of code within the same project.
Usage:
timer.reset()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
# Reset the timer when the Move button is pressed
while True:
console.clear()
console.print(timer.time(SECONDS))
wait(50, MSEC)
if robot.get_button(MOVE):
timer.reset()
tiempo#
time returns the time since the timer was last reset as a decimal. The timer is automatically reset at the start of a project.
Usage:
timer.time(units)
Parámetros |
Descripción |
|---|---|
|
The unit that represents the time: |
# Display the time until the Move button is pressed
while True:
console.clear()
console.print(timer.time(SECONDS))
wait(50, MSEC)
if robot.get_button(MOVE):
timer.reset()
Constructores#
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()
Parámetros |
Descripción |
|---|---|
Este constructor no tiene parámetros. |
# Display the time of two timers
wait(2, SECONDS)
timer_1 = Timer()
while True:
console.clear()
console.print("Timer: ", timer.time(SECONDS))
console.new_line()
console.print("timer_1: ", timer_1.time(SECONDS))
wait(15, MSEC)