ardupilot/libraries/AP_Scripting/examples/relay_control.lua
Andrew Tridgell 5920c52285 Scripting: simple relay example
toggle at 50Hz
2021-02-09 10:23:06 +11:00

12 lines
261 B
Lua

-- 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