help: rgb controller for one push button

i’m trying to control the rgb strip light in 3 push button, one button for the mode to change either red, green and blue. the 2 push button will increase and decrease the brightness. this is working but i want to add one more function for the mode and that is the Multicolor LED cycles through the a spectrum of colors / light frequencies

int ledRed=3;
int ledBlue=5;
int ledGreen=6;


int valueRed=254;
int valueGreen=254;
int valueBlue=254;


int ButtonSelect = 8;
int ButtonReduce = 9;
int ButtonIncrement = 10;

int ledSelected = 0;

void setup() 
{ 


 pinMode(ButtonSelect, INPUT);
 pinMode(ButtonReduce, INPUT);
 pinMode(ButtonIncrement, INPUT);
 
 analogWrite(ledRed, 255);  
} 



int pinLed = 0;

void loop() 
{ 
    
  int valueLed = 0;

  if (digitalRead(ButtonSelect) == HIGH) 
  {
     pinLed++;  
     
  
     if (pinLed > 2) { pinLed=0; }
  

     analogWrite(ledRed, 0);
     analogWrite(ledGreen, 0);
     analogWrite(ledBlue, 0);      
     
    
     while (digitalRead(ButtonSelect) == HIGH) {  }            
     delay(10); 
  }
 

  if (digitalRead(ButtonIncrement) == HIGH) 
  { 
    if (pinLed == 0) { valueRed++; }
    if (pinLed == 1) { valueGreen++; }
    if (pinLed == 2) { valueBlue++; }
    
    delay(5);
   }
   

  if (digitalRead(ButtonReduce) == HIGH) 
  { 
    if (pinLed == 0) { valueRed--; }
    if (pinLed == 1) { valueGreen--; }
    if (pinLed == 2) { valueBlue--; }
    
    delay(5);
   }        
   

   if (valueRed > 254) { valueRed=254; }
   if (valueRed < 0) { valueRed=0; }
   
   if (valueGreen > 254) { valueGreen=254; }
   if (valueGreen < 0) { valueGreen=0; }

   if (valueBlue > 254) { valueBlue=254; }
   if (valueBlue < 0) { valueBlue=0; }    


 if (pinLed == 0) { analogWrite(ledRed, valueRed); }
 if (pinLed == 1) { analogWrite(ledGreen, valueGreen); }
 if (pinLed == 2) { analogWrite(ledBlue, valueBlue); }
 
}
 
}

Sure, go ahead. Although it is different from the way that I would do it, you have done much of the hard work already.

By the way, your posting missed step 1 of the following…

To post code and/or error messages:

  1. Use CTRL-T in the Arduino IDE to autoformat your complete code.
  2. Paste the complete autoformatted code between code tags (the </> button)
    so that we can easily see and deal with your code.
  3. Paste the complete error message between code tags (the </> button)
    so that we can easily see and deal with your messages.

Before posting again, you should read the three locked topics at the top of the Programming Questions forum, and any links to which these posts point.

If your project involves wiring, please provide a schematic and/or a wiring diagram and/or a photograph of the wiring.

Good Luck!