Created
December 19, 2017 10:05
-
-
Save schappim/dfed4724a30428de394e6a93597f5c55 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
int led = 13; // We are going to make Pin 13 LED blink | |
int threshold = 28; // Change this to the level you want the light to come on | |
int volume; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(led, OUTPUT); | |
} | |
void loop() { | |
volume = analogRead(A0); // Read the value from the Analog PIN A0 | |
Serial.println(volume); | |
delay(100); | |
if (volume >= threshold) { | |
digitalWrite(led, HIGH); //Turn ON Led | |
} 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