mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-21 16:18:29 -04:00
AP_Scripting: added opendog lua demo
This commit is contained in:
parent
ac5594566e
commit
86d53c96d1
23
libraries/AP_Scripting/examples/opendog_demo.lua
Normal file
23
libraries/AP_Scripting/examples/opendog_demo.lua
Normal file
@ -0,0 +1,23 @@
|
||||
-- demo of waving paw of opendog
|
||||
--
|
||||
local flipflop = true
|
||||
|
||||
pwm = { 1500, 1500, 2000,
|
||||
1500, 1500, 1000,
|
||||
1500, 1500, 1500,
|
||||
1500, 1500, 1500 }
|
||||
|
||||
local angle = 0.0
|
||||
|
||||
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
|
Loading…
Reference in New Issue
Block a user