Servers by jDrones

How to control relays with buttons already in use

Hi all,

I have connected a relay switch module to pixhawk (rover firmware 4.0.0) and I can change it with dedicated buttons of the Joystick, but I would like to switch it with the same buttons I use to arm and disarm the system but I can’t get it…

Any ideas with the parameters to do that?


Which radio do you have ?

Happy flying :slightly_smiling_face:

I have no radio controller. I only use a Logitech F310 Joystick connected to the laptop and 4G telemetry throught raspberry connected to the pixhawk

You mean u want to control two different outputs of FC using one button off your joystick?

I believe there is way you can do that inside mission planner.

If you were using a TX then it is pretty simple channel assignment.

I think you can do it with lua scripting, when state is armed change the relay status. If you look at examples of lua you should get some ideas.

Lua scripting wiki:

Get status with:

is_armed() -Returns a true if vehicle is currently armed.

Set relay with:

on(relay_num) - Turns the requested relay on.
off(relay_num) - Turns the requested relay off.

Yeah , that’s right

Happy flying :slightly_smiling_face:

Thanks for the suggestion. I Will try it.

Servers by jDrones