Helper function - sets the buzzer but also sets the state variable