Hello! For some reason even though I can dim my blue and green LED pins, the red pin won't dim (it either is completely off or maximum brightness).
I'm using a clear anode RGB LED (link: https://www.sparkfun.com/products/10820
and below is an image of how I've set up my board:
Here's my code:
int redPin = 12;
int greenPin = 11;
int bluePin = 10;
setColor(100, 0, 0); // Red
setColor(0, 100, 0); // Green
setColor(0, 0, 100); // Blue
void setColor(int red, int green, int blue)
analogWrite(redPin, 255-red); //I did the 255- because I'm using an anode LED
If you look at my code, when I try that RGB value my LED red pin won't turn on at all, even though the green and blue pins do light up but very dim. I'm trying to get my red pin to dim to help better fuse colors but it's not working.
Any value below 128 for the red doesn't work, and anything above it turns it on and it acts as if it were 255. Any help would be appreciated!