Building Sound Sensor Project
Sound Sensor Project
To gain more experience with building projects using sensors, I decided to build the music reactive LED circuit found on the instructables website.This circuit uses a sound sensor which controls whether the LED flashes on or off - depending if music is playing or not.
Code written for this circuit
int soundsensor = 3;int led = 7; // defining pin numbersvoid setup() {pinMode (soundsensor, INPUT);pinMode (led, OUTPUT);}void loop(){int sensorvalue = digitalRead (soundsensor); //if the sound intensity is higher than thresholdif (sensorvalue == 1) //then sensor would return the value as 1{digitalWrite(led, HIGH);}else{digitalWrite(led, LOW);}}
Comments