I implemented 2 different ways. Sound detection was tested with clapping.
One was a simple way. Each clap turned it on and off. The other was clapping once to turn it on and clapping twice to turn it off.
It would’ve been better if the sensor recognized the sound of claps. The light was also controlled by any noises because it senses any loud sounds. This is the reason why the clapping light has not been made to the public yet.
1. On/Off Toggle
2. Clap Once for On, Clap Twice for Off
It recognizes the number of noises within 500ms.