does that even compile for you, you seem to have output down the bottom, which is not from that code!
Function calls and code in file scope is not C++, what libraries do you use?
You have not explained what you expect to have happen.
You have not explained what actually happens.
The code that you posted will not compile as is (no main, no setup, no loop, missing brackets).
You are calling Serial.println inside of an Interrupt Service Routine (ISR). This is generally a bad thing to do.
I stared at this code for over an hour and couldn't see it. Of course I must use ! not ~ I now feel very foolish.
Thank you. I've been up late nights on my project and I guess fatigue is creeping in. To bad the compiler didn't choke on this. I just couldn't understand why execution hung up in the While loop.
I'll go back to work and change the code.
Of course, this is a small fragment of pages of code and the function calls are my own.