Newbie How to add second LED to basic project

OK I went through the basic project and it works. I now want to add a second LED to pin 7 on the Arduino board. I thought I could declare PIN 7 after 13 by adding a commma but I received and error "first_sketch:2: error: expected unqualified-id before numeric constant". Sorry if this is a dumb question but I am a newbie. Take it easy on me.

Thanks

//Example Blinking Light

const int LED = 13; //LED connected to // digital pin 13

void setup() {

pinMode(LED, OUTPUT); // sets the digital // pin as output }

void loop()

{ digitalWrite(LED, HIGH); // turns the LED on delay(500); // waits for a second digitalWrite(LED, LOW); // turns the LED off delay(200); // waits for a second

}

This doesn’t show how you tried to declare pin 7. Show us what you did so we can tell you why it didn’t work.

Ah! Sorry about that. Below is what I did to declare pin 7. Thanks again for the help.

//Example Blinking Light

const int LED = 13,7; //LED connected to // digital pin 13

void setup() {

pinMode(LED, OUTPUT); // sets the digital // pin as output }

void loop()

{ digitalWrite(LED, HIGH); // turns the LED on delay(500); // waits for a second digitalWrite(LED, LOW); // turns the LED off delay(200); // waits for a second

}

stash100: Ah! Sorry about that. Below is what I did to declare pin 7. Thanks again for the help. const int LED = 13,7; //LED connected to // digital pin 13

One: When you're posting code, use the code symbol to enclose it. It's the '#' symbol in the menu bar above. Second: You need to declare variables separate. The lineconst int LED = 13;essentially says: the variable LED has the value of 13. So what you're trying to do is say: the variable LED has the value 13,7 ... that does not compute. You need a new variable, like:

const int LED_ONE = 13;
const int LED_TWO = 7;

Now, you can refer to each individual pin as either the variable 'LED_ONE' or 'LED_TWO'. This also means you need to change the rest of the code to address each one. I will leave that as an exercise.

Thank you so much for the reply.

I will give this a try and let you know.