There's an error I don't know how to fix I basically have a bread board with an rgb led and a peizo buzzer with a photocell.

I have the codes for both. If I put a code for the rgb, it works. If I put the code for the peizo, it works. Once I paste both codes onto it it says there's an error because "void setup" and "void loop" are already defined. What do I do to get both things to work?

rgb led code:

/*
Adafruit Arduino - Lesson 7. RGB Fader
*/
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 &gt; 255) red = 0;
  }
  if (digitalRead(greenSwitchPin) == LOW)
  {
    green ++;
    if (green &gt; 255) green = 0;
  }
  if (digitalRead(blueSwitchPin) == LOW)
  {
    blue ++;
    if (blue &gt; 255) blue = 0;
  }
  analogWrite(redLEDPin, red);
  analogWrite(greenLEDPin, green);
  analogWrite(blueLEDPin, blue);
  delay(10);
}


peizo code:

int speakerPin = 12;
int photocellPin = 0;

void setup()
{
}

void loop()
{
  int reading = analogRead(photocellPin);
  int pitch = 200 + reading / 4;
  tone(speakerPin, pitch);
}
Putting all other possible issues aside such as pin and timing conflicts. 

Rename the sketch setup() and loop() functions, for instance, rgb_led_setup() and rgb_led_loop(), and peizo_setup() and peizo_loop(), then rewrite:

void setup() { 
  rgb_led_setup(); 
  peizo_setup(); 
} 

void loop() { 
  rgb_led_loop(); 
  peizo_loop(); 
}


Cheers!