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);
}