Devices & Components
Arduino Uno Rev3
Buzzer
Jumper wires (generic)
LED (generic)
Solderless Breadboard Half Size
SparkFun Sound Detector (with Headers)
Hardware & Tools
Tape, Double Sided
Project description
Code
sound detecting security system
arduino
1int soundSensor=2; 2int LED=4; 3boolean LEDStatus=false; 4 5void setup() { 6 pinMode(soundSensor,INPUT); 7 pinMode(LED,OUTPUT); 8 9} 10 11void loop() { 12 13 int SensorData=digitalRead(soundSensor); 14 if(SensorData==1){ 15 16 if(LEDStatus==false){ 17 LEDStatus=true; 18 digitalWrite(LED,HIGH); 19 } 20 else{ 21 LEDStatus=false; 22 digitalWrite(LED,LOW); 23 } 24 } 25 }
Downloadable files
diagram
diagram
diagram
diagram
Comments
Only logged in users can leave comments