user50927: I am trying to write some code, which I barely grasp - but it's coming along! But I think I've hit a wall that I could using some help getting  over... 
I'm not asking for you to fix my code - I know that's not how I am going to learn, maybe explain why my code isn't doing what I want it to, and/or some resources I can using to learn about it. 
I think it has something to do with me trying to use the same pins in the initialization part since the error is about a conflicting declaration..
Here's my breadboard layout if this helps too:

//ABOUT - This programs goal is to make a button cycle through three    different 'modes'
//Mode 1 - make a RGB LED cycle through its colors
//Mode 2 - make the same RGB LED fade-cycle through its colors
//Mode 3 - make the same RGB LED blink on-off all three colors at once
//Additional modes may follow but this is the beginning.

//currently all my initialization code is from three different programs and I think that's why parts are not working.. I think
//I can share the mode initialization code for each mode....?  But the face code uses the uint8_t vs just int so maybe not?

//Button Cycle - this is the first part of my code, designed to teacah me how to make a button cycle through to different parts of the code

int counter = 0;
int switchPin = 13;
int LEDB = 11;
int LEDG = 10;
int LEDR = 9;

//RGB LED Cycle Circuit - mode 1
const int redLED=3; //red LED connects to digital pin 8
const int blueLED=5; //blue LED connected to digital pin 7
const int greenLED=6; //green LED connected to dogotal pin 6

//RGB LED Fade Circuit - mode 2
const uint8_t redLED = 3;  // pin connected to the red LED - I don't understand why this code says const uint8_t  -  
const uint8_t blueLED = 5;  // pin connected to the green LED
const uint8_t greenLED = 6; // pin connected to the yellow LED

void setup()
{
  Serial.begin(9600); //I added this to help learn what the counter was doing
  pinMode(switchPin, INPUT);
  pinMode(LEDR, OUTPUT);
  pinMode(LEDG, OUTPUT);
  pinMode(LEDB, OUTPUT);
}

void loop() {
  //Handle input
  int switchVal = digitalRead(switchPin);
  if(switchVal == LOW) //changed from HIGH which was making the modes appear to change randomly - may come in useful later but not what I want initially
  {
    delay(500);  
    counter ++;
    Serial.println(counter); //prints value of counter to serial monitor so I can see why it appeared to be random
    //I learned that when the switchVal == HIGH was in place the counter would cycle continuously. Making each button
    //press appear random. Changing this to LOW made the counter wait for a LOW event before counting. Increasing the 
    //delay to half a sec gives time to release the button before the counter continues.

    //Reset count if over max mode number
    if(counter > 3)
    {
      counter = 1; //in serial monitor you will see that the counter goes to 4 but this code tells the program that 4 = 1 so it runs the right mode
    }
  }
  else
    //Change mode 1
    switch (counter) {
    case 1:
      analogWrite(LEDB, 000);
      analogWrite(LEDG, 000);
      analogWrite(LEDR, 255);

      //start LED Cycle - this is simply pasted in from the LED cycle program - seems to work fine

      digitalWrite(redLED,HIGH);//turns the LED on
      delay(100);//waits 3 seconds
      digitalWrite(redLED,LOW);//turns the LED off
      digitalWrite(greenLED,HIGH);//turns the LED on
      delay(100);//waits 3 seconds
      digitalWrite(greenLED,LOW);//turns the LED off
      digitalWrite(blueLED,HIGH);//turns the LED on
      delay(100);//waits 3 seconds
      digitalWrite(blueLED,LOW);//turns the LED off
      break;

    //mode 2 code
    case 2:
      analogWrite(LEDR, 000);
      analogWrite(LEDB, 000);
      analogWrite(LEDG, 255);

      //LED Fade Cycle
      // Fade an analog pin up and down.
      void fade(uint8_t pin);
      {
        for (int i = 1; i <= 255; i=i+5) {
          delay(10);  
        }
        for (int i = 254; i >= 0; i=i-5) {              
          delay(10);
        }     
      }
      //void loop(); - think I can only have one void loop so I'm commenting this out for now..
      {
        //Serial.println(F("Fading GREEN."));
        fade(redLED);
        //Serial.println(F("Fading BLUE."));
        fade(blueLED);
        //Serial.println(F("Fading YELLOW."));
        fade(greenLED);
      }
      break;

    //mode 3 not coded yet - waiting to make mode 2 work
    case 3:
      analogWrite(LEDG, 000);
      analogWrite(LEDR, 000);
      analogWrite(LEDB, 255);
      break;
    }
}


user4143: There are two immediate things I can see wrong:

You have two sets of the same pin definitions. You only want one set. Both sets are identical - once it's defined its defined - you can't define it again as the same thing.
You seem to have a function defined in the middle of your loop() function.  That can't work - functions have to be separate things. (also you don't want a ; in your function definition...)


50927: <p>I am trying to write some code, which I barely grasp - but it's coming along! But I think I've hit a wall that I could using some help getting  over... </p>

<p>I'm not asking for you to fix my code - I know that's not how I am going to learn, maybe explain why my code isn't doing what I want it to, and/or some resources I can using to learn about it. </p>

<p>I think it has something to do with me trying to use the same pins in the initialization part since the error is about a conflicting declaration..</p>

<p>Here's my breadboard layout if this helps too:</p>

<p><a href="https://i.stack.imgur.com/Iv6zg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Iv6zg.png" alt="My breadboard"></a></p>

<pre><code>//ABOUT - This programs goal is to make a button cycle through three    different 'modes'
//Mode 1 - make a RGB LED cycle through its colors
//Mode 2 - make the same RGB LED fade-cycle through its colors
//Mode 3 - make the same RGB LED blink on-off all three colors at once
//Additional modes may follow but this is the beginning.

//currently all my initialization code is from three different programs and I think that's why parts are not working.. I think
//I can share the mode initialization code for each mode....?  But the face code uses the uint8_t vs just int so maybe not?

//Button Cycle - this is the first part of my code, designed to teacah me how to make a button cycle through to different parts of the code

int counter = 0;
int switchPin = 13;
int LEDB = 11;
int LEDG = 10;
int LEDR = 9;

//RGB LED Cycle Circuit - mode 1
const int redLED=3; //red LED connects to digital pin 8
const int blueLED=5; //blue LED connected to digital pin 7
const int greenLED=6; //green LED connected to dogotal pin 6

//RGB LED Fade Circuit - mode 2
const uint8_t redLED = 3;  // pin connected to the red LED - I don't understand why this code says const uint8_t  -  
const uint8_t blueLED = 5;  // pin connected to the green LED
const uint8_t greenLED = 6; // pin connected to the yellow LED

void setup()
{
  Serial.begin(9600); //I added this to help learn what the counter was doing
  pinMode(switchPin, INPUT);
  pinMode(LEDR, OUTPUT);
  pinMode(LEDG, OUTPUT);
  pinMode(LEDB, OUTPUT);
}

void loop() {
  //Handle input
  int switchVal = digitalRead(switchPin);
  if(switchVal == LOW) //changed from HIGH which was making the modes appear to change randomly - may come in useful later but not what I want initially
  {
    delay(500);  
    counter ++;
    Serial.println(counter); //prints value of counter to serial monitor so I can see why it appeared to be random
    //I learned that when the switchVal == HIGH was in place the counter would cycle continuously. Making each button
    //press appear random. Changing this to LOW made the counter wait for a LOW event before counting. Increasing the 
    //delay to half a sec gives time to release the button before the counter continues.

    //Reset count if over max mode number
    if(counter &gt; 3)
    {
      counter = 1; //in serial monitor you will see that the counter goes to 4 but this code tells the program that 4 = 1 so it runs the right mode
    }
  }
  else
    //Change mode 1
    switch (counter) {
    case 1:
      analogWrite(LEDB, 000);
      analogWrite(LEDG, 000);
      analogWrite(LEDR, 255);

      //start LED Cycle - this is simply pasted in from the LED cycle program - seems to work fine

      digitalWrite(redLED,HIGH);//turns the LED on
      delay(100);//waits 3 seconds
      digitalWrite(redLED,LOW);//turns the LED off
      digitalWrite(greenLED,HIGH);//turns the LED on
      delay(100);//waits 3 seconds
      digitalWrite(greenLED,LOW);//turns the LED off
      digitalWrite(blueLED,HIGH);//turns the LED on
      delay(100);//waits 3 seconds
      digitalWrite(blueLED,LOW);//turns the LED off
      break;

    //mode 2 code
    case 2:
      analogWrite(LEDR, 000);
      analogWrite(LEDB, 000);
      analogWrite(LEDG, 255);

      //LED Fade Cycle
      // Fade an analog pin up and down.
      void fade(uint8_t pin);
      {
        for (int i = 1; i &lt;= 255; i=i+5) {
          delay(10);  
        }
        for (int i = 254; i &gt;= 0; i=i-5) {              
          delay(10);
        }     
      }
      //void loop(); - think I can only have one void loop so I'm commenting this out for now..
      {
        //Serial.println(F("Fading GREEN."));
        fade(redLED);
        //Serial.println(F("Fading BLUE."));
        fade(blueLED);
        //Serial.println(F("Fading YELLOW."));
        fade(greenLED);
      }
      break;

    //mode 3 not coded yet - waiting to make mode 2 work
    case 3:
      analogWrite(LEDG, 000);
      analogWrite(LEDR, 000);
      analogWrite(LEDB, 255);
      break;
    }
}
</code></pre>
 4143: <p>There are two immediate things I can see wrong:</p>

<ol>
<li>You have two sets of the same pin definitions. You only want one set. Both sets are identical - once it's defined its defined - you can't define it again as the same thing.</li>
<li>You seem to have a function defined in the middle of your loop() function.  That can't work - functions have to be separate things. (also you don't want a <code>;</code> in your function definition...)</li>
</ol>
