I've been researching this for a while now and I can't find anything conclusive on how to do what I want to do.
Im using the APM 2.6, which has the ATmega2560
Im working on a drone copter/plane hybrid, it will be an airplane with tilt rotors, and will be able to do VTOL. I am almost done with all the coding, calibration, and control schemes for it, except for one last item. I have four motors that will be able to rotate (point horizontal or vertical that is) individually via a four servos. That adds up to 8 outputs. I need one last servo to control a rudder, and the only option now is to use one of A0-A12 pins and change them to a digital output.
According to HERE (scroll to the bottom) the way to make the analog pins act as a digital output pin, you add 54 to the Analog pin number. So if I wanted to write to A6, i would say write(60, PWMValue). I want to write a PWM value, but i have only gotten either 5V or 0V to output from A6. Could some provide code or commands/functions on how to initiliaze and analog pin to a digital output and then how to write a PWM value to it.
To add to the confusion, ive looked at the pin mapping schematic HERE. If you look at the link, there are three columns, the "Pin Number", "Pin Name", and "Mapped Pin Name". From looking at examples, when i want to write to one of the standard output PWM pins (1-8) I can use the command rcout.write(1, 1500). Where the first argument "1" is the corresponds to the "Mapped Pin Name". So what is confusing is, if i follow the directions of adding 54, when i say write(60,PWMvalue), there is no corresponding digital pin 60 underneath the "Mapped Pin Name" column. So how does it know where to write to?. So maybe then, it knows to look at the absolute pin indexed number? But if that is the case, then it would be writing to Digital Pin 30, so then should i be saying write(60, PWMvalue)?
If someone could give me the commands/code on how to do this that would be great. Really any help would be great.