Sound Triggered LED
Step 1 - Build the Project
Use a sound trigger to take noise readings from your environment. If the noise reaches a threshold, turn on an LED for the entire time the noise is above your threshold.
Step 2 - Upload the Code
Step 3 - Read the Walkthrough
Within the setup(), set the center pin of your sound trigger to an INPUT and the LED as an OUTPUT.
In the loop, create an integer to hold the noise threshold. Experiment with this number so that you can clap and turn on the light.
The if statement takes a reading from the sound sensor and compares it to your threshold. If the reading is greater than the threshold, the if statement is true and the code inside the loop will run.
Otherwise, the else statement runs, leaving the LED light off.