help: rgb controller by one button to 8 function

help: can you help me the code of rgb strip by controlling one push buutton.. by pressing one its will truns red , another press become green, blue, white, and the last pres it will d RGB LED Fade (seven Colors) and 2 push button to increase and decrease the brightness.

Yes we can. But you have to provide more details and code ;)

Just a hint, buttons state change and button debounce (pssst, Bounce2 library ;) and state machines :) Enough to read for now I think ;)

this is my code and its working but i don’t know how to add the Multicolor LED cycles through the a spectrum of colors / light frequencies

// Defines the pin used for each color
int ledRed=3;
int ledBlue=5;
int ledGreen=6;

// Save the values to designate each color (0-254)
int valueRed=254;
int valueGreen=254;
int valueBlue=254;

// Defines the pins used for buttons
int BotonSelect = 8;
int BotonReduce = 9;
int BotonIncrement = 10;

int ledSelected = 0;

void setup() 
{ 

//Note that the pins used by the buttons are INPUT
pinMode(BotonSelect, INPUT);
pinMode(BotonReduce, INPUT);
pinMode(BotonIncrement, INPUT);

analogWrite(ledRed, 255);  
} 

// Default value: Red
// 0= Red, 1=Green, 2=Blue
int pinLed = 0;

void loop() 
{ 
   
 int valueLed = 0;

 if (digitalRead(BotonSelect) == HIGH) 
 {
    pinLed++;  
    
    // To not spend laps
    if (pinLed > 2) { pinLed=0; }
 
    // We turn off all LEDs and eluego is what will display only the LED Selected
    analogWrite(ledRed, 0);
    analogWrite(ledGreen, 0);
    analogWrite(ledBlue, 0);      
    
    // We wait until the button is released
    while (digitalRead(BotonSelect) == HIGH) {  }            
    delay(10); // We expect a little more ...
 }

 // Check if the value increases
 if (digitalRead(BotonIncrement) == HIGH) 
 { 
   if (pinLed == 0) { valueRed++; }
   if (pinLed == 1) { valueGreen++; }
   if (pinLed == 2) { valueBlue++; }
   
   delay(5);
  }
  
 // Check if the value reduce
 if (digitalRead(BotonReduce) == HIGH) 
 { 
   if (pinLed == 0) { valueRed--; }
   if (pinLed == 1) { valueGreen--; }
   if (pinLed == 2) { valueBlue--; }
   
   delay(5);
  }        
  
 // This is to not be of turns in the output value (0-254)
  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; }    

//  Update the color value Selected
if (pinLed == 0) { analogWrite(ledRed, valueRed); }
if (pinLed == 1) { analogWrite(ledGreen, valueGreen); }
if (pinLed == 2) { analogWrite(ledBlue, valueBlue); }

}

Please edit your post and remove the unnecessary quote and place the code between code-tags. See How to use this forum.

After that, give us some more details. My crystal ball is still in repair. What kind of leds? Are they working now? What do they do now? What have you tried? What did not work? What happened instead? Is a "Boton" a button? How have you wired it? Did you already read about state machines like I told you to? And Bounce2?

Looking forward to a long post ;)

yes its working. i'm using led strip common cathode. but i want to add another mode the Multicolor LED cycles through the a spectrum of colors / light frequencies .

im using 3 push button, one push button is the mode either red, blue, green, but i want to add one more the Multicolor LED cycles through the a spectrum of colors / light frequencies. the another 2 push button will increase and decrease the brightness for the led.

Your variable pinLed determines what mode you are in: RED, BLUE or GREEN so there are three modes 0, 1 or 2. Now you need a fourth mode, so pinLed needs to go to 3.

When pinLed is 0, 1 or 2 you run the code that you have now. When pinLed is 3 you do the fading effect. I have rearranged your code to call a function named oneColor() when the mode is 0, 1 or 2. If mode is 3 a function named fadeColors() is called. There is no fading effect now, it just flashes the three leds in turn.

Give this code a try, if it works correctly with your buttons you just need to write the fade function.

// Defines the pin used for each color
int ledRed = 3;
int ledBlue = 5;
int ledGreen = 6;

// Save the values to designate each color (0-254)
int valueRed = 254;
int valueGreen = 254;
int valueBlue = 254;

// Defines the pins used for buttons
int BotonSelect = 8;
int BotonReduce = 9;
int BotonIncrement = 10;

int ledSelected = 0;

void setup()
{

  //Note that the pins used by the buttons are INPUT
  pinMode(BotonSelect, INPUT);
  pinMode(BotonReduce, INPUT);
  pinMode(BotonIncrement, INPUT);

  analogWrite(ledRed, 255);
}

// Default value: Red
// 0= Red, 1=Green, 2=Blue
int pinLed = 0;

void loop()
{

  int valueLed = 0;

  if (digitalRead(BotonSelect) == HIGH)
  {

    // We turn off all LEDs and eluego is what will display only the LED Selected
    analogWrite(ledRed, 0);
    analogWrite(ledGreen, 0);
    analogWrite(ledBlue, 0);

    pinLed++;

    // We wait until the button is released
    while (digitalRead(BotonSelect) == HIGH) {  }
    delay(10); // We expect a little more ...

    // To not spend laps
    if (pinLed > 3) {
      pinLed = 0;
    }

  }

  if ( pinLed == 3 )
  {

    // fade mode
    fadeColors();

  } else {

    oneColor();

  } // else

}

void oneColor()
{

  // Check if the value increases
  if (digitalRead(BotonIncrement) == HIGH)
  {
    if (pinLed == 0) {
      valueRed++;
    }
    if (pinLed == 1) {
      valueGreen++;
    }
    if (pinLed == 2) {
      valueBlue++;
    }

    delay(5);
  }

  // Check if the value reduce
  if (digitalRead(BotonReduce) == HIGH)
  {
    if (pinLed == 0) {
      valueRed--;
    }
    if (pinLed == 1) {
      valueGreen--;
    }
    if (pinLed == 2) {
      valueBlue--;
    }

    delay(5);
  }

  // This is to not be of turns in the output value (0-254)
  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;
  }

  //  Update the color value Selected
  if (pinLed == 0) {
    analogWrite(ledRed, valueRed);
  }
  if (pinLed == 1) {
    analogWrite(ledGreen, valueGreen);
  }
  if (pinLed == 2) {
    analogWrite(ledBlue, valueBlue);
  }

}

void fadeColors()
{

  // test, change to fade code
  analogWrite(ledRed, 255);
  delay(500);
  analogWrite(ledRed, 0);

  analogWrite(ledGreen, 255);
  delay(500);
  analogWrite(ledGreen, 0);

  analogWrite(ledBlue, 255);
  delay(500);
  analogWrite(ledBlue, 0);

}

[quote author=Blue Eyes link=msg=2944271 date=1475418174] Your variable pinLed determines what mode you are in: RED, BLUE or GREEN so there are three modes 0, 1 or 2. Now you need a fourth mode, so pinLed needs to go to 3.

When pinLed is 0, 1 or 2 you run the code that you have now. When pinLed is 3 you do the fading effect. I have rearranged your code to call a function named oneColor() when the mode is 0, 1 or 2. If mode is 3 a function named fadeColors() is called. There is no fading effect now, it just flashes the three leds in turn.

Give this code a try, if it works correctly with your buttons you just need to write the fade function.

[/quote]

thanks sir its working but i want in fading is the 7 color will be the output like(green, blue,red, yellow,purple,white and skyblue)

Then I wish you good luck ;) Ignoring all the basic and important questions isn't helping you to get goodwill to help you out ;)