Minutero#
The Timer
attribute can also be called without Brain
as its own Class.
tiempo()#
The time(units)
method returns the elapsed time.
Parámetros |
Descripción |
---|---|
unidades |
Optional. A valid TimeUnits type. The default is |
Devuelve: El tiempo transcurrido en la unidad especificada.
claro()#
The clear()
method resets the timer value to 0.
Devoluciones: Ninguna.
reiniciar()#
The reset()
method resets the timer value.
Devoluciones: Ninguna.
sistema()#
The system()
method returns the system time.
Devuelve: La hora del sistema en milisegundos.
sistema_de_alta_resolución()#
The system_high_res()
method returns the high-resolution system time.
Devuelve: El tiempo del sistema de alta resolución en milisegundos.
evento()#
The event(callback, delay, arg)
method registers a callback function for a timer event.
Parámetros |
Descripción |
---|---|
llamar de vuelta |
La función de devolución de llamada que se llamará cuando se produzca el evento. |
demora |
El retraso antes de que se llame a la función de devolución de llamada. |
arg |
Opcional. Los argumentos que se pasarán a la función de devolución de llamada. |
Devoluciones: Ninguna.
// Create a new function timer_event().
void timer_event() {
Brain.Screen.print("timer event");
}
int main() {
// Run timer_event() after 100 milliseconds.
Brain.Timer.event(timer_event, 100);
}