Last active
September 21, 2015 10:53
-
-
Save riponroy79/bbcebd0b7be31ecedfc4 to your computer and use it in GitHub Desktop.
Sound Sensor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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