Missing pulse detector misses pulse!

if (newtime > (savedtime +( savedtime / 2))

Maybe also replace this with

if (newtime > (savedtime + (savedtime >> 1)))

I'm not sure if the compiler is smart enough to detect division by a power of two, but I never like to take the chance. If for some reason it's not, division takes a whole lot longer than bit-shifting, which takes a single instruction cycle to perform on a byte.

Also, if possible, work with unsigned integers (or even unsigned chars) rather than longs (they're half the size and hence the mathematical operations involving them are much faster). For example, you are expecting your pulses to be only a few hundred microseconds, so you should be able to safely cast the result of the pulseIn() call to an unsigned int.

  • Ben