Making a while-loop timeout

you are testing the value rad on topSwitchPin inside the while-conditional that tests that value... basically up to three times per loop.

why?