I have been labouring through a lot of code to understand the Pixhawk AUX OUT Pins.
I have written several tests to turn them ON & OFF and not much makes sense.
Pins 5 & 6 ( Virtual 54 & 55 ) react very oddly despite how I set the parameters for Virtual pin numbers and the maximum number of PWM pins set. I am using 0.
By addressing pin 6 and using the relay.on(6) function and relay.off(6) I can get some results noted by a voltmeter reading 0 or 3.29 volts.
Pins 50 through 53 do not react ever.
So I would appreciate it ( and so would a number of other folks ) if a Developer would jump in here and explain what is going on!
Thanks
I set the number of BRD_PWM_COUNT to 0 and restarted the board.
From there I set the relay pin to each number 50 - 55 and it works just fine.
I have channel 8 set to the relay pin and changing it causes the pin to go from .296 to 3.39.
Maybe your getting confused as to Relay number and Aux Pins.
RELAY_PIN - is the first relay or (0).
RELAY_PIN2 - is the second relay or (1).
So you need to set what Aux pin you want the relay to enable. There are only two relays.
You were thinking you could use all 6 Aux pins at once like a 6 shooter. That would be way too easy.
iseries,
Thanks very much for your notes. I have a few questions.
I am using BRD_PWM_COUNT = 0.
In one note you said “From there I set the relay pin to each number 50 - 55”.
Where did you do this? In Mission Planner, I can see a place to set only 4:
RELAY_PIN,
RELAY_PIN2,
RELAY_PIN3,
RELAY_PIN4
In the other note, you said " there are only 2 relays". Did you mean that only 2 AUX OUT pins can control relays?
I got the feeling that if I set BRD_PWM_COUNT to 0, then I could use all 6 AUX OUT pins for relays.
You said “I have channel 8 set to the relay pin”. How/where did you set this up and which pin did you use?
Also, I am not using an RC channel from my Spektrum radio to do any on this. I am writing c/c++ code within the Pixhawk to do this stuff. If you have working code in that area, I would be very interested.
I am building from the APMrover2 base code, strictly c/c++ stuff. While I do use MP (& Mavlink ) for mission planning, I am not using relays through the MP commands.
I guess I will have to dive into the fundamental I/O code to see where this thing is going.
Is there anyone else doing c/c++ control of relay pins on a Pixhawk ???
Jim