sos light using while statements

to your question about what is and is not working the program is now working but i was wondering if there was a cleaner shorter way.