one of the errors in the originally posted code was buzzer was undefined and it looked like it was simply a pin being turned on/off so i picked the built-in led. if you have a buzzer connected to some pin, just change the value of buzzer to the pin the buzzer is connected to.