Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Arduino RGB LED Clear

Tags:

rgb

arduino

led

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?

like image 204
August Avatar asked Jan 27 '26 01:01

August


2 Answers

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.

like image 157
Jamie F Avatar answered Jan 29 '26 01:01

Jamie F


Brown color example

Its weird, but blue color seems exactly opposite to brown color, that you are trying to achieve. Moreover, when I've tried to invert the color (255 - x), I've got blue colors. Maybe something is wrong with PWM configuration?

like image 23
Valera Kolupaev Avatar answered Jan 29 '26 01:01

Valera Kolupaev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!