-
Notifications
You must be signed in to change notification settings - Fork 17.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AP_Scripting: add bindings for the AP_TemperatureSensor
- Loading branch information
1 parent
0020cf5
commit 83c9b32
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--[[ | ||
simple example of reading a temperature sensor | ||
--]] | ||
|
||
local MAV_SEVERITY = {EMERGENCY=0, ALERT=1, CRITICAL=2, ERROR=3, WARNING=4, NOTICE=5, INFO=6, DEBUG=7} | ||
|
||
--[[ | ||
main update function, called at 1Hz | ||
--]] | ||
function update() | ||
local temperature_C = temperature_sensor:get_temperature(0) | ||
gcs:send_text(MAV_SEVERITY.INFO, string.format("Temperature: %f", temperature_C)) | ||
return update, 1000 | ||
end | ||
|
||
-- start running update loop | ||
return update, 1000 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters