Fun with LEDs, I wonder why.....

I was reading up on using 2 digital pins to alternatively light a led and use it as a sensor.

So I set up 2 red leds from the same bag with 2 220 ohm resistors from the same bag (5% tol) and using port manipulation have one lit while the other detects using 4 pins. Took a while to debug/adjust but it works.. however

I'm seeing one led go LOW in say 12000 micros (not bright room light) the other one takes like 18000 to go LOW (in brighter light, 500 and 800 kind of range) and that seems a bit much difference but maybe it's what I should expect? Maybe the breadboard connections vary that much?

I tried modifying the 'charge time' of the 'fast led' so the fast one got 20 micros charge time (after trying 8, 10, 12) compared to the other led getting 5 micros charge time, but it really didn't help ... maybe 5 micros fills them up and maybe 1 micro would do the same.

Not saying anything is wrong, just trying to get a handle on why such a big difference? I'm still not done with the code but having seen this I'm not so sure I want to go further. But it was fun playing with PORTD and the Arduino Pin Map. ;^) The loooooooong timeout is just so it's easy to see, in shade, the leds actually do only shine one at a time.

And here's the obligatory code and hardware instructions:

Hardware on UNO;
pin 3 to 220 ohm resistor to long leg of red led 0, short leg to pin 4
pin 5 to 220 ohm resistor to long leg of red led 1, short leg to pin 6
done

byte  start = 1, pin[2][2] = { 
  3,4,5,6 }; // portD 3-6

byte  B;

unsigned long time, now, timeout, interval = 1000000; // all in microsecs

void prompt( void )
{
  Serial.println( "User commands" );
  Serial.println( "h or ? to get this" );
  Serial.println( "p to pause, enter p again to restart" );
  Serial.println( "r to report interval" );
  Serial.println( "- to reduce interval" );
  Serial.println( "= to increase interval" );
};

void setup()
{
  Serial.begin(57600);
  time = now = micros();
  timeout = interval;
  start = 1;
  prompt();
}

/*
PORTD maps to Arduino digital pins 0 to 7
 
 DDRD - The Port D Data Direction Register - INPUT/OUTPUT
 PORTD - The Port D Data Register - LOW/HIGH
 PIND - The Port D Input Pins Register - read only 
 */
/*    wiring pin 3 -> 220Ohm -> +anode - led - -cathode -> pin 4
 light up is pin 3 OUTPUT HIGH and pin 4 is OUTPUT LOW 
 */

byte stage = 0;

/*  
 DDRD - The Port D Data Direction Register - INPUT/OUTPUT
 PORTD - The Port D Data Register - LOW/HIGH
 PIND - The Port D Input Pins Register - read only   
 */
void loop()
{
  if ( start == 1 )
  {
    switch ( stage ) 
    {
      //    led 0 detect, led 1 emit
    case 0 :
      {
        DDRD |= ( 0xf << 3 );  // pins 3,4,5,6 as OUTPUT
        PORTD = ( PORTD | ( 0x7 << 3 )) & (( 0x7 << 3 ) | 0x87 );  // pin 3,4,5 are HIGH 
        delayMicroseconds( 5 );
        DDRD &= (( 0xd << 3 ) | 0x87 );    //  pin 4 as INPUT
        PORTD &= (( 0xc << 3 ) | 0x87 );   //  pin 3 & 4 as LOW 
        time = micros();
        stage++;
        //      Serial.print( stage, DEC );
        //      Serial.print( "," );
      }
      break;

      //   read pin 4 until decayed or timeout
    case 1 :
      {
          //          Serial.print( "s1 " );
          now = micros();
          B = PIND;
          if ((( B & ( 0x2 << 3 )) == LOW ) || ( now - time >= timeout )) 
          {
            Serial.print( " led 0 - " );
            Serial.print( B & ( 0x2 << 3 ));
            Serial.print( " " );
            Serial.println(( now - time ), DEC );
            //          Serial.print( stage, DEC );
            //          Serial.print( "," );
            //        else  Serial.println( "timeout" );
            stage++;
          }
      }
      break;

      //    led 0 detect, led 1 emit
    case 2 :
      {
        //          Serial.print( "s2 " );
        DDRD |= ( 0xf << 3 );  // pins 3,4,5,6 as OUTPUT
        PORTD = ( PORTD | ( 0xd << 3 )) & (( 0xd << 3 ) | 0x87 );  // pins 3,5,6 are HIGH 
        delayMicroseconds( 5 );
        DDRD &= (( 0x7 << 3 ) | 0x87 );    //  pin 6 as INPUT
        PORTD &= (( 0x3 << 3 ) | 0x87 );   //  pin 5 & 6 as LOW
        time = micros();
        stage++;
        //      Serial.print( stage, DEC );
        //      Serial.print( "," );
      }
      break;

      //   read pin 6 until decayed or timeout
    case 3 :
      {
        //        Serial.print( "s3 " );
          now = micros();
          B = PIND;
          if ((( B & ( 0x8 << 3 )) == LOW ) || ( now - time >= timeout )) 
          {
            Serial.print( " led 1 - " );
            Serial.print( B & ( 0x8 << 3 ));
            Serial.print( " " );
            Serial.println(( now - time ), DEC );
            //          Serial.print( stage, DEC );
            //          Serial.print( "," );
            //        else  Serial.println( "timeout" );
            stage = 0;
          }
      }
      break;
    }
  }

  if ( Serial.available())
  {
    B = Serial.read();
    if ( B == 'p' )
    {
      while ( Serial.available())  Serial.read();
      start = start ^ 1;
    }
    else if ( B == '-' )
    {
      if ( interval > 1100UL )  interval -= 1000UL;
      else interval = 100UL;
    }
    else if ( B == '=' )
    {
      if ( interval < 0xFFFFFFFF - 1000UL )  interval += 1000UL;
      else interval = 0xFFFFFFFF;
    }
    else if ( B == 'r' )
    {
      Serial.println( interval);
    }
    else if ( B == 'h' )
    {
      prompt();
    }
    timeout = interval;
  }
}