Scripting: simple relay example

toggle at 50Hz
This commit is contained in:
Andrew Tridgell 2021-02-08 11:33:21 +11:00
parent 55de28c0fd
commit 5920c52285

View File

@ -0,0 +1,11 @@
-- toggle a relay at 50Hz
local RELAY_NUM = 0
function update() -- this is the loop which periodically runs
relay:toggle(RELAY_NUM)
return update, 20 -- reschedules the loop at 50Hz
end
return update() -- run immediately before starting to reschedule