const int buz=11; // ledpin and soundpin are not changed throughout the process const int sound=A5; const int threshold=100; // sets threshold value for sound sensor void setup() { pinMode(buz,OUTPUT); pinMode(sound,INPUT); } void loop() { int soundsens=analogRead(sound); // reads analog data from sound sensor if (soundsens>=threshold) { digitalWrite(buz,HIGH); //turns buzzer on delay(1000); } else{ digitalWrite(buz,LOW); } }
soundsens
main
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)