I'm not sure why I am having a hard time wrapping my head around this but I'm working on a project where I have an rgb led strip and I want to control the color and brightness of the strip with my arduino. I can control the color just fine but when it comes to brightness I'm not sure where to start.
Which rgb led strip? Link?
Its just your standard 5050 led strips.
" I can control the color just fine but when it comes to brightness I'm not sure where to start."
If your script is working to control the color, it should be pretty easy to control the brightness of each color with analogWrite().
Show us a copy of your code please.
int redPin = 9;
int bluePin = 10;
setColor(167, 0, 255);
void setColor(int red, int green, int blue)
red = (255 - red)*bright;
green = (255 - green)*bright;
blue = (255 - blue)*bright;
The issue I am running into is overall brightness or intensity. I'm just not sure how to program that or if I need to handle that in the circuit
Try this for the loop()
setColor(167, 255, 255);
setColor(20, 200, 25);
setColor(40, 50, 25);
setColor(9, 20, 25);
BTW "int bright=.1;" will not work. int will not take decimals.
Alright, Cool. I didn't even notice I put int instead of float but is there a way to have a variable control the brightness?
" is there a way to have a variable control the brightness?"
There is a way to have a variable to control the three different colors brightness.
Try the code I suggested, and if it works sorta, we can discuss using a single variable.
Alright, Thanks but I actually found a better solution to my problem. I think I'm going to us the HSV model which allows for the control I need. Once again thanks for the help, Ill keep you guys posted on what happens.