that code does the serout and clears all variables every time you get 1 pulse larger than 90. It doesn't wait until you have received the whole signal.