Created
May 6, 2019 17:11
-
-
Save maximeadjigble/4b5a19e281dc0ae5a00769107aa9f44e to your computer and use it in GitHub Desktop.
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
int soundLevel = 0; | |
int ledPin = 12; | |
bool toggle = false; | |
void toggleLEDState(){ | |
digitalWrite(ledPin, toggle); | |
toggle = !toggle; | |
} | |
void setup() { | |
pinMode(ledPin, OUTPUT); | |
} | |
void loop(){ | |
soundLevel = analogRead(A0); | |
if(soundLevel >= 650) { | |
delay(100); | |
toggleLEDState(); | |
} | |
delay(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment