Hi! I am very very new to playing with Arduino code.

Hi!
I am very very new to playing with Arduino code. I’m currently trying to do something that seems quite simple. I have a standard (non-addressable) strip of 12v RGBWs. I’ve successfully set up and Uno and the breadboard with a 5K pot for each color channel. That works great. Now, I’d love to pulse the single color I’ve dialed in with the pots. Pretty much every code scenario I can think to try either overrides the pot output and pulses all channels simultaneously or pulses four different combinations of channels in a set and starts over. Any help would be greatly appreciated. Below is the code I used:

int const rPotPin = A2;
int const gPotPin = A1;
int const bPotPin = A0;
int const wPotPin = A3;

int const rOutPin = 3;
int const gOutPin = 5;
int const bOutPin = 6;
int const wOutPin = 9;

int rVal;
int gVal;
int bVal;
int wVal;

int fadeAmount = 5;

int brightness1 = 0;
int brightness2 = 0;
int brightness3 = 0;
int brightness4 = 0;

void setup()
{
pinMode(rOutPin, OUTPUT);
pinMode(gOutPin, OUTPUT);
pinMode(bOutPin, OUTPUT);
pinMode(wOutPin, OUTPUT);
}

void loop()
{
rVal = analogRead(rPotPin) / 4;
gVal = analogRead(gPotPin) / 4;
bVal = analogRead(bPotPin) / 4;
wVal = analogRead(wPotPin) / 4;

analogWrite(rOutPin, rVal);
analogWrite(gOutPin, gVal);
analogWrite(bOutPin, bVal);
analogWrite(wOutPin, wVal);

// the following is the unsuccessful addition to try and
//pulse the settings for each channel (simultaneously)
//at their dialed in output throught the pots/analog pins

analogWrite(rVal, brightness1);
analogWrite(gVal, brightness2);
analogWrite(bVal, brightness3);
analogWrite(wVal, brightness4);

brightness1 = brightness1 + fadeAmount;

if (brightness1 <= 0 || brightness1 >= rVal) {
fadeAmount = -fadeAmount;

};
brightness2 = brightness2 + fadeAmount;

if (brightness2 <= 0 || brightness2 >= gVal) {
fadeAmount = -fadeAmount;

};
brightness3 = brightness3 + fadeAmount;

if (brightness3 <= 0 || brightness3 >= bVal) {
fadeAmount = -fadeAmount;

};
brightness4 = brightness4 + fadeAmount;

if (brightness4 <= 0 || brightness4 >= wVal) {
fadeAmount = -fadeAmount;

}
// wait for 30 milliseconds to see the dimming effect
delay(30);
}

analogWrite expects a pin and a value. These lines:
analogWrite(rVal, brightness1);
analogWrite(gVal, brightness2);

are not going to work as expected since you are trying to use rVal as a pin number, and that could be anything from 0 to 255. The pin number needs to be whatever you defined above.

[I’m guessing a bit as to what look you are going for here.]

If you want to pulse whatever is dialed in down to zero and then back up, you might try mapping each xVal based on a varying brightness value. Then they can all scale down and up together at a related rate.

//In this mapping setup brightness should range from 0 to 255.
uint8_t rScaled = map( brightness, 0, 255, 0, rVal );
uint8_t gScaled = map( brightness, 0, 255, 0, gVal );
uint8_t bScaled = map( brightness, 0, 255, 0, bVal );
uint8_t wScaled = map( brightness, 0, 255, 0, wVal );

When brightness is 255, the scaled values will be what’s dialed in on the pots.
When brightness is 128, the scaled values will be half of what’s dialed in.
When brightness is 0, they will all reach zero.

Then you can feed the scaled values into the analogWrite:
analogWrite(rOutPin, rScaled);
analogWrite(gOutPin, gScaled);

Also, while testing and working things out it is very useful to put some print statements in your code so you can see what values variables have as you change things.
Serial.print(rVal); Serial.print(" "); Serial.println(rScaled);

Wow, Marc! This is super helpful info. I’ll give this a shot and post how it goes. Thank you so much for your time! I really appreciate it.