Timers
Software Timers
This module contain the timers
to handle time and timed events
class Timer
Timer()
Creates a new timer. The max number of timers is 8.
method one_shot
one_shot(delay, fn, arg=None)
Activates the timer in one shot mode. Function fn(arg)
is executed only once after delay
milliseconds.
method interval
interval(period, fn, arg=None)
Activates the timer in interval mode. Function fn(arg)
is executed every period
milliseconds.
method clear
clear()
Disable the timer.
method destroy
destroy()
Disable the timer and kills it.
method start
start()
Start the timer. A started timer begins counting the number of passing milliseconds. Such number can be read by calling
Timer.get()
.
method reset
reset()
Reset the timer. A reset timer restarts counting the number of passing milliseconds from zero. Counting towards the callback trigger is not reset.
Returns the number of milliseconds passed since the start or the last reset.
method reset_trigger
reset_trigger()
Reset the timer and the counting towards the callback trigger. A reset timer restarts counting the number of passing milliseconds from zero.
Returns the number of milliseconds passed since the start or the last reset.
method get
get()
Return the number of milliseconds passed since the start or the last reset.