mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-05 07:28:29 -04:00
Scripting: simple relay example
toggle at 50Hz
This commit is contained in:
parent
55de28c0fd
commit
5920c52285
11
libraries/AP_Scripting/examples/relay_control.lua
Normal file
11
libraries/AP_Scripting/examples/relay_control.lua
Normal 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
|
Loading…
Reference in New Issue
Block a user