Help needed RGB led fader with reset button

Hi! :slight_smile:
I’m wondering how i’m suppose to add an reset button to work with my rgb led fader.

Here is the code used.

int redLEDPin = 11;
int greenLEDPin = 10;
int blueLEDPin = 9;

int redSwitchPin = 7;
int greenSwitchPin = 6;
int blueSwitchPin = 5;

int red = 0;
int blue = 0;
int green = 0;

void setup()
{
pinMode(redLEDPin, OUTPUT);
pinMode(greenLEDPin, OUTPUT);
pinMode(blueLEDPin, OUTPUT);
pinMode(redSwitchPin, INPUT_PULLUP);
pinMode(greenSwitchPin, INPUT_PULLUP);
pinMode(blueSwitchPin, INPUT_PULLUP);
}

void loop()
{
if (digitalRead(redSwitchPin) == LOW)
{
red ++;
if (red > 255) red = 0;
}
if (digitalRead(greenSwitchPin) == LOW)
{
green ++;
if (green > 255) green = 0;
}
if (digitalRead(blueSwitchPin) == LOW)
{
blue ++;
if (blue > 255) blue = 0;
}
analogWrite(redLEDPin, red);
analogWrite(greenLEDPin, green);
analogWrite(blueLEDPin, blue);
delay(10);
}

Sorry for my shaky English :S
Very thankful for any responses!

Capture.PNG

int redLEDPin = 11;
int greenLEDPin = 10;
int blueLEDPin = 9;

int redSwitchPin = 7;
int greenSwitchPin = 6;
int blueSwitchPin = 5;
int resetSwitchPin = 4;

int red = 0;
int blue = 0;
int green = 0;

void setup()
{
  pinMode(redLEDPin, OUTPUT);
  pinMode(greenLEDPin, OUTPUT);
  pinMode(blueLEDPin, OUTPUT);
  pinMode(redSwitchPin, INPUT_PULLUP);
  pinMode(greenSwitchPin, INPUT_PULLUP);
  pinMode(blueSwitchPin, INPUT_PULLUP);
  pinMode(resetSwitchPin, INPUT_PULLUP);
}

void loop()
{
  if (digitalRead(redSwitchPin) == LOW)
  {
    if (++red > 255) red = 0;
  }
  if (digitalRead(greenSwitchPin) == LOW)
  {
    if (++green > 255) green = 0;
  }
  if (digitalRead(blueSwitchPin) == LOW)
  {
    if (++blue > 255) blue = 0;
  }
  if (digitalRead(resetSwitchPin) == LOW)
  {
    blue = red = green = 0;
  }
  analogWrite(redLEDPin, red);
  analogWrite(greenLEDPin, green);
  analogWrite(blueLEDPin, blue);
  delay(10);
}

Just like the other buttons, see above ;)