user47131: This bug/stupidity-of-myself/problem is killing me:
I'm have created an RGB strip controller that cycles through the additive-rgb-color spectrum while turning a potentiometer.
I have a pot hooked up to my Arduino Nano v3 (from AZ-Delivery, not official Arduino). Then I have an RGB amplifier hooked up to the Arduino with each phase (R, G, B, V+) and to an external power supply (12V by 2A max).
I shortened my program and removed all the value-to-colour-conversion because that has nothing to do with the problem:
void loop() {
    ColorVal = analogRead(pinPot); //read value of color poti
    ColorByte = map(ColorVal, 0, 1023, 0, 255); //Scales 0-1023 to 0-255

    // potvalue to color conversion
    // ...

    // write via PWM to LED
    analogWrite(pinR, R);
    analogWrite(pinG, G);
    analogWrite(pinB, B);
}

My problem: Theoretically you would expect the system to show white when all variables (R, G and B) are set to 255. However, it behaves the other way around. When all values are set to 255 it's off and vice versa. Another example: When R = 255 and G = 0 and B = 0 Green and Blue are lighting and Red is off.
I thought this has to do with polarity or something but I cannot seem to find it out.

user972: The RGB LED strip has a common anode (V+). When you put 12 V on R, G or B, the LEDs have 12 V on both sides, so there is no voltage across it and no current.
And if you put 0 V, they have 12 V across it and light up.
To fix it, just invert the PWM value in your code:
analogWrite(255-pinR, R);
analogWrite(255-pinG, G);
analogWrite(255-pinB, B);


47131: <p>This bug/stupidity-of-myself/problem is killing me:<br>
I'm have created an RGB strip controller that cycles through the additive-rgb-color spectrum while turning a potentiometer.</p>

<p>I have a pot hooked up to my Arduino Nano v3 (from AZ-Delivery, not official Arduino). Then I have an RGB amplifier hooked up to the Arduino with each phase (R, G, B, V+) and to an external power supply (12V by 2A max).</p>

<p>I shortened my program and removed all the value-to-colour-conversion because that has nothing to do with the problem:</p>

<pre class="lang-c++ prettyprint-override"><code>void loop() {
    ColorVal = analogRead(pinPot); //read value of color poti
    ColorByte = map(ColorVal, 0, 1023, 0, 255); //Scales 0-1023 to 0-255

    // potvalue to color conversion
    // ...

    // write via PWM to LED
    analogWrite(pinR, R);
    analogWrite(pinG, G);
    analogWrite(pinB, B);
}
</code></pre>

<p><strong>My problem:</strong> Theoretically you would expect the system to show white when all variables (R, G and B) are set to 255. However, it behaves the other way around. When all values are set to 255 it's off and vice versa. Another example: When R = 255 and G = 0 and B = 0 Green and Blue are lighting and Red is off.</p>

<p>I thought this has to do with polarity or something but I cannot seem to find it out.</p>
 972: <p>The RGB LED strip has a common anode (V+). When you put 12 V on R, G or B, the LEDs have 12 V on both sides, so there is no voltage across it and no current.</p>

<p>And if you put 0 V, they have 12 V across it and light up.</p>

<p>To fix it, just invert the PWM value in your code:</p>

<pre class="lang-c++ prettyprint-override"><code>analogWrite(255-pinR, R);
analogWrite(255-pinG, G);
analogWrite(255-pinB, B);
</code></pre>
