I am working with Arduino Uno REV3. I have a project that uses common ground RGB LED. When I hook up to 11,10,9 using analogWrite 0-255 only works on 11. 10,9 works when told to go to 255, anything else is off. If I hook it to/code it to 11,6,5 all of them work as intended (0-255).
Possible useful information: I have a servo hooked to 3 and a pushbutton on 8. Both work fine in every scenario. I have tried to switch LEDs around ((11,10,9)(10,11,9)(9,11,10)...) and only the color of LED that is hooked to 11 works properly. I have replaced the microcontroller and it has the same issue.
The servo library uses timer 1. Timer 1 is used for PWM on pins 9 and 10, and using it for the servo instead puts it into a different mode so it can't be used for PWM anymore.
There are versions of the servo library that use timer2 instead, which takes out PWM on 3 and 11, but this gives less resolution in the positions that can be specified for the servo (since it's an 8-bit timer not a 16-bit timer like timer1)
Pins 5 and 6 are handled by timer0, but timer0 is generally not co-opt'ed for other uses, because it's also used for time-keeping (delay and millis), and doing anything other than PWM with it will break that.
Google "Arduino Pinout", and look for one that shows things like OC0A next to the PWM pins - OC stands for Output Compare (the mode used for PWM), the number is the number of the timer, and the letter is the channel (most timers on AVR chips have two channels. A rare few have 3 or 1 - one of the timers on the micro/leo is like that).
Thank you! Servo library knocking out 9 & 10 PWM functionality. I didn't see it coming. One more question on the subject. I moved the servo to 9 or 10, and the servo seems to be working properly. Is it better to keep the servo pin off 9 & 10 and move the servo pin to 11 or doesn't it matter?
You can use servos on any pin - there is no advantage or disadvantage to any specific pin (so you can pick pins that don't have any special functions, or at least not ones you need)
Regardless of which pin you have it controlling the servo on, it takes out PWM on pins 9 and 10.