Those lines of '1' in your output is "pulse_complete being true". You set it to true at the top of the loop, just before printing the value after "point 2.1". At "point 2.7" you show that the value is still 'true' (1) just before the bottom of the 'while' loop so the condition is tested and the 'while' loop ends.