I have tried just while with the same outcome
Sorry, correction
The serial.print in the above code reads 20 and hangs