Coding AUX servo functions into 2.7.3


I need to control 2 Aux servos from a APM1 board. Trying to use the camera channels and change the code to control them directly.

If anyone could help me with:

- where are the output pins initiallised?

- I am trying to use one of these lines to control the servo.

 g.rc_5.servo_out = 900;

 APM_RC.OutputCh(Ch_6, 900);

Added into the medium loop

Am I on the right track?

Thanks for any help.


You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –


  • I think you are on the right track. I've been searching on documentation for doing this but haven't had too much luck. I'm using an Arduplane and older firmware, but the process should be similar.

    I've been able to get servos to move by using the APM_RC.OutputCh command you are using. However the trouble I'm having is I need to put a delay after each move command to get them to move significantly, otherwise they just twitch like crazy. Obviously this isn't acceptable behavior because the rest of the Ardupilot locks up while the servos are moving.

    I'm trying to figure out if there is something overwriting or re-initializing the servos after I send my move commands. That seems to be the only thing I could think of that could cause that problem as I think the way APM_RC.OutputCh is intended to work is to send the command once and have the servos move to the appropriate position (correct me if I'm wrong!)

    I've gone through the RC libraries, radio.pde, etc but haven't had a whole lot of luck

    Here is my code (which I'm running inside the one_second_loop, using a static int test_flag as a boolean type variable)

    if (test_flag==0){
    g.rc_5.servo_out = 2000;
    if (test_flag==1){
    g.rc_5.servo_out = 1000;

    This code reliably makes a servo move back and forth, but the APM locks up during the delay commands (at least the HUD does) Without the delay the servo only buzzes/twitches. With a shorter delay the servo will move but not completely.

    Need to figure out how to control them without a delay!

    Hope this can help and I hope we can get some good replies

    • Is this still actual?


      I want to implement a further servo to the ardu-plane for tilting rotors.

      If i´ll test with your code Ryan, at which output pin I should check? Or its an Aux-output?




This reply was deleted.


Laurie J. Troy liked Jasper Kueppers's profile
Apr 1
Timothy Miller liked Joseph Udofia's profile
Mar 18
Joseph Udofia liked Joseph Udofia's profile
Mar 3