Browse Source

AP_Scripting: update analog input example to check for valid pin

gps-1.3.1
Iampete1 3 years ago committed by Andrew Tridgell
parent
commit
86e56934b6
  1. 4
      libraries/AP_Scripting/examples/analog_input_and_GPIO.lua

4
libraries/AP_Scripting/examples/analog_input_and_GPIO.lua

@ -6,7 +6,9 @@ @@ -6,7 +6,9 @@
-- some are used by the main AP code, ie battery monitors
-- assign them like this in the init, not in the main loop
local analog_in = analog:channel()
analog_in:set_pin(13) -- typically 13 is the battery input
if not analog_in:set_pin(13) then -- typically 13 is the battery input
gcs:send_text(0, "Invalid analog pin")
end
-- load a input pwm pin
local pwm_in = PWMSource()

Loading…
Cancel
Save