Arduplane Toggle Relay with Button

Hi there,
I was just trying to get that working but didn’t find a way to do it.
I have a X52 Logitech HOTAS Joystick as the only “RC Input” and now i would like to toggle my relay with a momentary button on said joystick. I can momentarily switch it with the “DO_SET_RELAY”, but it releases when i let go off the button. Has anyone got an idea on how to do this?

Thanks in advance.

Hello @chempner

This is the expected behaviour because the ardupilot will just copy the logic state of your button into the relay, so imagine your JS button is sending a PWM value interpreted as logic level HIGH when pressed and LOW when unpressed. This way, DO_SET_SERVO will only apply the same logic level to the relay output. In order to fix it, you can try to setup your joystick button to a latch functioning, so the logic levels are toggled at each button press (really do not know if it is possible with your device, not familiar with it).