digital write does not work properly

Hi All,

I have just written my first code on Arduino Uno. The purpose is to blink 2 LEDs alternately using pin 5 and 6. However, only one LED is lit. I thought may be pins were bad, but I checked separately, they are good. The problem seems to be that the LED to which digitalWrite occurs later works, the one where it occurs first does not work. for example: for the code below led 5 blinks but not led 6 if pin numbers are switched, then led 6 blinks but not led 5

Does anybody know what is going on?

thanks, Rishabh

/*
Written by RK060414
light up external LED on pin 5 and 6.
The external circuit includes an resistor in series with the LED.
Use of 1K resistor prevented LED lighting, therefore a lower value was used
*/
int led_pins1 = 6;
int led_pins2 = 5;

void setup(){
   // put your setup code here, to run once:
   pinMode(led_pins1, OUTPUT);  //selects the pin number to be configured as INPUT/OUTPUT/INPUT_PULLUP
   pinMode(led_pins2, OUTPUT);  
}

void loop(){
  // put your main code here, to run repeatedly: \
  digitalWrite(led_pins1, HIGH);
  delay(500);
  digitalWrite(led_pins2, HIGH);
  delay(500);
  digitalWrite(led_pins1, LOW);
  delay(500);
  digitalWrite(led_pins2, LOW);
  delay(500);

}

// put your main code here, to run repeatedly: \ <— delete this character

Continued lines are merged into one long line. A continued line is a line which ends with a backslash, . The backslash is removed and the following line is joined with the current one. No space is inserted, so you may split a line anywhere, even in the middle of a word. (It is generally more readable to split lines only at white space.)

The trailing backslash on a continued line is commonly referred to as a backslash-newline.

If there is white space between a backslash and the end of a line, that is still a continued line. However, as this is usually the result of an editing mistake, and many compilers will not accept it as a continued line, GCC will warn you about it.

For all the gory details...

http://gcc.gnu.org/onlinedocs/gcc-3.2/cpp/Initial-processing.html

thanks David, it is working now. So basically my first digitalWrite was being converted into a comment in the compiled code

kasliwal: So basically my first digitalWrite was being converted into a comment in the compiled code

Well ignored rather than converted but yes.