I'm trying to use boolean to break a while loop. In this example, I want to press the button to have the LED light up for 2s and then turn it off. The code now does turn on the LED, but it never turn it off. Why?
By putting a semi-colon after the if statement here you have created an empty if clause (ie, no action), so nothing happens.
Just as a tip - you don't have to test with an if in the else part of the statement - else is already everything else so if it not == HIGH everything else (in this case == LOW) will flow into the else without the special test.