Piezo buzzer controlled by push button using Arduino - Wired Connection
Circuit Diagram:
Required Components:
Arduino Nano/Uno - 1 nos
Piezo Buzzer - 1 nos
Push button - 1 nos
Battery - 1 nos
330k resister - 1 nos
10k resister - 1 nos
Program Code:
#define buzzer 8
#define buttonpin 7
void setup(){
pinMode(buttonpin,INPUT);
}
void loop(){
if(digitalRead(buttonpin)==HIGH){
tone(buzzer,3500);
}
else{
noTone(buzzer);
}
}
Comments
Post a Comment