Interfacing KY-012(Active Buzzer) with Arduino
Interfacing an Active Buzzer with Arduino
//Sketch-Straight beep
int active_buzzer =11;// connect the active buzzer to the pin 7 of Arduino.
void setup() {
pinMode(active_buzzer,OUTPUT);
}
void loop() {
digitalWrite(active_buzzer,HIGH);
delay(5);
digitalWrite(active_buzzer,LOW);
delay(1);
}
//Sketch-Alarm beep
int active_buzzer =11;// set a variable name active buzzer and assign pin to 3
void setup() {
pinMode(active_buzzer,OUTPUT);// set pin as an output
}
void loop() {
digitalWrite(active_buzzer,HIGH);
delay(500);
digitalWrite(active_buzzer,LOW);
delay(5);
}
Comments
Post a Comment