Search code examples
rgbarduinoled

Arduino RGB LED Clear


I have an RGB LED and have pins to 9, 10, 11 and a pin to ground. Resistors have been provided for R, G, and B.

When I do:

  analogWrite(r, 255); // I see a red color
  analogWrite(g, 0);
  analogWrite(b, 0);

  analogWrite(r, 0);
  analogWrite(g, 255); // I see a green color
  analogWrite(b, 0);

  analogWrite(r, 0);
  analogWrite(g, 0); // I see a blue color
  analogWrite(b, 255);

When I do:

  analogWrite(r, 153);
  analogWrite(g, 102);
  analogWrite(b, 51);

it does not look brown to me, more like a blue color. Am I missing something I need to do?


Solution

  • Brown is a very difficult color to achieve. (It's actually dark red. Brown isn't in the rainbow.)

    Make sure that your colors are balanced: write a dim white / gray, 128, 128, 128 and make sure this looks white. Then write a 255, 255,255 and make sure this looks white. If these don't look white, adjust your resistors to reduce current through the component that is too bright (be careful not to allow too much current and burn out the LED.