Scheduler
DUELink Engine includes a scheduler to help execute tasks repeatedly. Use SStart
to start scheduling a function. The arguments are SStart(func, time, count)
, where 'func' is the function to schedule, time
is the delay between executions, and finally count
is for the scheduler count.
You can check the current status of a scheduler using Sstatled(func)
. The returned value shows remaining count for the scheduler will still need to run for.
It is possible to to abort a schedule at any time using SAbort(func)
.
_i = 0
SStart("Blink", 100, 50)
while 1
if (_i % 10) = 0: PrintLn("stat: ", Sstatled("Blink")) :_i=_i+1 :end
# If button is pressed, SAbort("Blink")
wend
fn Blink()
DWrite(0, _i&1)# status LED is always on pin 0
_i=_i+1
fend