When I was a kid I suffered some terrible nightmares and today I still do. I've created the world's first scream activated nightlight. No more waking up terrified. My new invention can wake anyone mid-nightmare with it's bright lights. The lights also provide a feeling of safety until it's time to go back to sleep.
I started off with just the scream activation part. I used the sound sensor on the CP Express. When loud noise is detected a loud noise is detected such as a scream, it turns on all the LEDs.
I added a switch that arms the nightlight when in the on position and disarms/turns off when in the off position. I did this by creating an IF statement inside another IF statement. The outside on checks the switch and the inside one checks to for the loud sound.
I added a potentiometer to be used as a dimmer so the user can select how bright they would like the nightlight. I have this code in a separate forever statment.
Comments
Please log in or sign up to comment.