dimming rgb led in one color

Hello,

I hope somebody can help me.
I have searched this forum and the internet for severall day how i can dim the brightnes of a rgb ledstrip.
I mean brightnes from 0 to 1 in one color.
There is a lot to find of fading and dimming between colors, but that is not what i want.

e.g. purple, orange

analogWrite(redPin, 40);
analogWrite(greenPin, 150);
analogWrite(bluePin, 200);

I used this commands to create an color. That works fine, but dimming doesn't work.
I used the pwn pins 9, 10, 11

when i used this commands:

analogWrite(redPin, 100);
analogWrite(greenPin, 100);
analogWrite(bluePin, 100);

and i change the values from 100 to 200 for all 3 colors than i can control the brightnes, but i have only a white color.

I want to do this with all possible colors.

I can figure it out how i can do this.
Can somebody help me? :slight_smile: Maybe with some example code or some hints

analogWrite(redPin, 40)
analogWrite(greenPin, 150)
analogWrite(bluePin, 200)

I used this commands to create an color. That works fine, but dimming doesn't work.
I used the pwn pins 9, 10, 11

In order to dim this colour each component of the colour ( the red, green and blue ) have to be reduced in the same ratio.
So to get a dimer colour you would have to use something like this, for a dimmer value:-

analogWrite(redPin,   20);
analogWrite(greenPin, 75);
analogWrite(bluePin,  100);

In fact it is not as easy as that due to the logarithmic nature of the eye but it should get you started.

I have searched some more on the internet, and finally i found the solution.

It can be found here:

Glad you found a soloution. It that was not the problem you posed.