int buzzerPin = 8;
int buttonPin = 7;
void setup() {
// put your setup code here, to run once:
pinMode(buzzerPin, OUTPUT);
pinMode(buttonPin, INPUT_PULLUP);
}
void loop() {
// put your main code here, to run repeatedly:
int buttonState = digitalRead(buttonPin);
if (buttonState == LOW) {
digitalWrite(buzzerPin, HIGH);
// delayMicroseconds(20000);
}
if (buttonState == HIGH) {
digitalWrite(buzzerPin, LOW);
}
}