how to blink 2 LEDs alternatively..??

I have connected 2 LEDs one in pin 12 and another in pin 11

How do I blink them alternatively...??

If LED a is on then LED b is off
and vice versa...

Something like this:

void setup(){
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
}

void loop(){
digitalWrite(11,LOW);
digitalWrite(12,HIGH);
delay(500);
digitalWrite(11,HIGH);
digitalWrite(12,LOW);
delay(500);
}

This is untested and uncompiled code, but should not give errors.

:stuck_out_tongue:
a simple thing
but didnt come to my mind...

I was just making it complicated with if and else statements... :stuck_out_tongue: