forked from mustafa-gokce/ardupilot-software-development
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_set_parameter.lua
30 lines (22 loc) · 874 Bytes
/
get_set_parameter.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-- Description: This script shows how to get and set a parameter
-- get and set a parameter
function get_set_parameter()
-- create SCR_USER1 parameter object
local SCR_USER1 = Parameter()
if not SCR_USER1:init("SCR_USER1") then
gcs:send_text(7, "Failed to initialize the parameter")
return
end
-- notify the user about the parameter value
gcs:send_text(7, "Value of SCR_USER1: " .. SCR_USER1:get())
-- set the parameter
local result = SCR_USER1:set(1)
-- notify the user about the result
gcs:send_text(7, "Parameter set operation result: " .. tostring(result))
-- notify the user about the parameter value
gcs:send_text(7, "Value of SCR_USER1: " .. SCR_USER1:get())
-- schedule the next call to this function
-- return get_set_parameter, 1000
end
-- start the script
return get_set_parameter()