Set a timer or interval
SetTimer( timernumber, timeout, parameter=0, repeat=0 )
Set up a timer with a timeout (in milliseconds) and an optional user supplied parameter. There are four independent timers available to each script.
After the given timeout, the “@Timer” event handler function will be called.
To cancel a timer, simply set the interval to 0 like this: SetTimer(0, 0)
timernumber | Timer number 0-3 |
timeout | Timeout in milliseconds, 1-3600000 (1h max) |
parameter | User defined value |
repeat | Number of times to repeat the timer (0-1000), or TIMER_INF for infinite |
none
main() { SetTimer(0, 5000, 1234, TIMER_INF); // Set up timer to call back every 5 seconds } @Timer(timerno, timeout, param) { // Code to run every time the timer expires }