How to use pulseIn to read both HIGH an LOW pulse width

mikedb:
Maybe the writing to the Array causes the delay.

I found this for a period counter.

ontime = pulseIn(pulse_ip,HIGH);

offtime = pulseIn(pulse_ip,LOW);
  period = ontime+offtime;

That works for a steady PWM signal but it skips two out of three HIGH pulses and two out of three LOW pulses. When the first pulseIn() finishes measuring a HIGH pulse it is because the pin went LOW at the end of the pulse. The second pulseIn() is too late to see the start of that LOW pulse so it has to wait until the pin goes HIGH and LOW again to catch the beginning of a LOW pulse. It then finishes when the pin goes HIGH again. That causes the first pulseIn() to miss the start of that HIGH pulse so it has to wait for the pin to go LOW and HIGH again.

To measure consecutive pulses you have to use something other than pulseIn(). The IRremote library uses a timer interrupt at about 50 microsecond intervals. It just counts consecutive HIGH or LOW samples.