A “Clapper” is a device that will turn on or off an AC appliance that is plugged into it, such as a lamp or fan when it “hears” you clap twice in approximate succession. Pete has built a Clever Clapper with various task. If user claps twice within one second, the circuit toggles the lamp output.
On becomes off and vice versa. If user clap three times within one second, the lamps begin dimming up and down via PWM until a fourth clap is detected or a one minute timeout occurs, whichever comes first. The brightness value is then stored and restored for subsequent toggling of the lights on/off with the two clap event. The project also has a relay output to turn on and off the moon lamp.
For more detail: Clever Clapper using ATtiny2313 microcontroller