Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Sound Sensor
/*
This is the code to make a LED blink with the music.
...Nillakash34...
*/
int led = 13;
int threshold = 490; //You Can Change This
int volume;
void setup() {
pinMode(led, OUTPUT);
Serial.begin(9600); // For debugging
}
void loop() {
volume = analogRead(A0); // Reads the value from the Analog PIN A0
if(volume>=threshold){
digitalWrite(led, HIGH); //Turn ON Led
delay(100);
}
else{
digitalWrite(led, LOW); // Turn OFF Led
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment