Simple but frustrating PWM Led Flashing Problems

Hello everyone,

I am having very annoying problems with PWM on pins 9-11. I started with an RGB led and followed some tutorials to make it color fade. It should work just fine, after a long time checking I decided to just try simple LEDs, I found out that PWM is only working on pin 11 and not on 10, 9. On pin 11 the LED flashes appropriately, on the other two they are just always on (at 5v)

I also noticed that when the RGB led was plugged in it was reading a constant 5v, when the single color led was in it was reading appropriately.

I did try a different RGB led also.

Could I have fried the PWM on those pins, would that make sense?


Are you running version 21? There was an optiboot-related bugfix affecting PWM between 20 and 21...

To be honest I think I am running 16 or so. I will check that out tonight. Thanks for the tip.

Double check that you defined them as outputs.

Here is my code:

int RED = 9;
int GREEN = 10;
int BLUE = 11;

void setup()
  pinMode(9, OUTPUT); 
  pinMode(10, OUTPUT); 
  pinMode(11, OUTPUT); 

void loop()

  for(int r = 0; r < 255; r+=5) {
    for(int g = 0; g < 255; g+=5) {
      for(int b = 0; b < 255; b+=5) {
        analogWrite(RED, r);
        analogWrite(GREEN, g);
        analogWrite(BLUE, b);


I did try with the latest software. Do I need to burn the new bootloader (I got my arduino about 8 months ago)