Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.