ardupilot/libraries/AP_Scripting/examples/opendog_demo.lua

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
487 B
Lua
Raw Normal View History

2020-05-31 00:55:46 -03:00
-- demo of waving paw of opendog
local pwm = { 1500, 1500, 2000,
1500, 1500, 1000,
1500, 1500, 1500,
1500, 1500, 1500 }
2020-05-31 00:55:46 -03:00
function update()
local t = 0.001 * millis():tofloat()
local angle = math.sin(t) * 0.5
pwm[6] = math.floor(1500.0 + angle*500.0)
for i = 1, 12 do
SRV_Channels:set_output_pwm_chan_timeout(i-1, pwm[i], 1000)
end
return update, 200
end
gcs:send_text(0, "opendog demo starting")
return update, 1000