I have written this function that I have isolated into an infinite while loop. I have no idea how but somehow it is able to escape the loop (while(pulse_complete == false)) without the condition being met!? I must be doing something very obviously daft! However, I cannot see it.
What would you like/expect to happen?
Maybe a cause of your problem: variables declared within a function will be lost at the end of the function.
If you want them to persist, you should declare them static or make them global.
Also there is a statement pulse_complete= true; in your function body...
Yes, I was hoping that pulse_complete= true; would keep it inside the while loop. when the Serial is printing 1 it is confirming that it is true however it still manages to escape the loop as if it was false. which it isnt.
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.