Do something once when switch closed, then blink LED until switch opened

Use a flag to indicate that beep has occurred, clear the flag when the switch is opened to allow beep again.