top
About Buy News Guide Ideas
Get a phatIO device here!

Back to Table of Contents

Scheduler

The scheduler allows code to be executed at regular intervals.

(every <millis> <code> ...)

Will execute the remaining arguments every <millis> milliseconds. millis can currently be between 1 and 65535 milliseconds (65 seconds).

For example the following will print “ping” to the keyboard every 2 seconds:

(every 2000 (keyboard "ping"))

The above will toggle/flash pin 0 every 100ms:

(defvar t 0)
(pinmode 0 OUT)
(every 100 (setpin 0 (= t (~ t))))
@Contact  |   Legal & Privacy  |    RSS  |   Development Twitter  |   Official Twitter
© phatIO 2012, All Rights Reserved.