LUA SRV_Channels:get_output_pwm returns "nil"

Hello every one,
I am trying to read the output pwm of AP by using Lua scripts,
this is my sample code,
where the function SRV_Channels:get_output_pwm(num) returns nil always.
I tries change “num” many times, I tried 3,4 (servo output number), and from 50 to 61(GPIO number).

function update()
    output_pwm1 = SRV_Channels:get_output_pwm(53)
    gcs:send_text(0, tostring (output_pwm1))

    return update, 1000
end
return update, 1000

The Adrupilot firmware is ArduRover V4.2.3 (2172cfb3)
can you help me,
Thanks.

SRV_Channels:get_output_pwm reads by function not pin number. So 53 is RCIN 3.

1 Like