Hey all, I have created a Lua script, that tries to recieve PWM from channel 5 of the transmitter, on detecting any change, it arms or disarms the quadcopter, depending on its initial state. Is this possible to do with ArduCopter? I haven’t tested it out yet, as we do not have our ESC’s and motors with us, but it would still be helpful if y’all could help.
Here is the code
control_var=rc:get_pwm(5)
function update()
if (control_var ~= (rc:get_pwm(5))) then
if arming:is_armed() then
arming:disarm()
elseif not arming:is_armed() then
arming:arm()
end
c_var=rc:get_pwm(5)
end
end
Any advice on syntax error/logic or flow would be appreciated.
Thanks!