minutero#
The timer attribute can also be called without brain as its own Class.
tiempo()#
The brain.timer.time(units) method returns the elapsed time.
Parámetros |
Descripción |
|---|---|
|
Optional. A valid |
Devuelve: El tiempo transcurrido en la unidad especificada.
claro()#
The brain.timer.clear() method resets the timer value to 0.
Devoluciones: Ninguna.
reiniciar()#
The brain.timer.reset() method resets the timer value.
Devoluciones: Ninguna.
sistema()#
The brain.timer.system() method returns the system time.
Devuelve: La hora del sistema en milisegundos.
sistema_de_alta_resolución()#
The brain.timer.system_high_res() method returns the high-resolution system time.
Devuelve: El tiempo del sistema de alta resolución en milisegundos.
evento()#
The brain.timer.event(callback, delay, arg) method registers a callback function for a timer event.
Parámetros |
Descripción |
|---|---|
|
La función de devolución de llamada que se llamará cuando se produzca el evento. |
|
El retraso antes de que se llame a la función de devolución de llamada. |
|
Opcional. Los argumentos que se pasarán a la función de devolución de llamada. |
Devoluciones: Ninguna.
# Define a function timer_event
def timer_event():
# The Brain will print that timer has expired on the
# Brain's screen.
brain.screen.print('timer has expired ')
# Initialize a Timer object.
t1 = Timer()
# Run timer_event after 1000 milliseconds of delay.
t1.event(timer_event, 1000, ('Hello',))