Hello I want to use the RSSI pins (for example AUX3) to read the voltage from a transducer. Because it is transducer it needs 5V in order to produce the voltage measurement (0-5V) and a GROUND. I use at the moment CUAV v5+ I make the parameters settings as described in site but I do not get 5 volts (there are ±S). I am following the instructions about setting parameters. Do I miss something?
I decided to use ADC port instead at the moment with 6,6V pin and I will check in future about RSSI.
Now I want to use LUA read the value of ADC port 6,6V and then act accordingly (show message to operator). The problem is that I am confuded as others say you can not do it through LUA and others say you can. Anyway I tried code
local analog_in = analog:channel()
if not analog_in:set_pin(14) then -- typically 13 is the battery input
gcs:send_text(0, "Invalid analog pin")
end
function update()
gcs:send_text(0, string.format("voltage: %0.2f", analog_in:voltage_latest()))
-- analog_in:voltage_average() the average voltage since the last call
-- analog_in:voltage_latest() the latest voltage reading
-- analog_in:voltage_average_ratiometric() the average ratiometric voltage (relative to the board 5v)
-- pwm_in:get_pwm_us() the latest pwm value in us
-- pwm_in:get_pwm_avg_us() the average pwm value in us since the last call
-- gpio:read(pin)
-- gpio:write(pin, state)
-- gpio:toggle(pin)
return update, 1000
end
return update()
from script libraries/AP_Scripting/examples/analog_input_and_GPIO.lua
and it shows message can not allocate memory.
Could you help me please?