Skip to content

Instantly share code, notes, and snippets.

@riponroy79
Last active September 21, 2015 10:53
Show Gist options
  • Save riponroy79/bbcebd0b7be31ecedfc4 to your computer and use it in GitHub Desktop.
Save riponroy79/bbcebd0b7be31ecedfc4 to your computer and use it in GitHub Desktop.
Sound Sensor
// Arduino Based Laser Sensor
// By Nillakash34
// nillakash34@gmail.com
// fb.com/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