How about this:
int led1 = 13;
int led2 = 2;
byte ledState = 0;
unsigned long current_millis;
unsigned long saved_millis;
void setup ( ) {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
}
void loop ( ) {
current_millis = millis(); // sample the "time"
if ( (current_millis - saved_millis)>=500){ // 500 mS gone by?
saved_millis = current_millis; // save the "time"
digitalWrite (led1, ledState); // flip the LEDs on/off
digitalWrite (led2, !ledState); // flip the LEDs on/off
ledState = 1-ledState; // set up for next pass thru loop - results in 1-0-1-0
}
// now your code is free to do other stuff here
}