Single and double clap switch

Hi Ben,

You have a first detection of sound = a clap
then you do a delay(200)

and then starts the for-loop that detects the second clap

you toggle your variable ledOn inside the loop for that shall detect the second clap

so this is what your program does

I did a quick googling and found this video which is pretty the same code as you have

Anyway you have been impatient about getting answers. Even writing pesonal messages. What you always can do until answers are posted is analysing your own code through serial output at a high baudrate of 115200 baud

void setup() {

Serial.begin(115200);
Serial.println("Setup-Start");

an then add
Serial.print(....

at places to printout with whatever you like to see while your program gets executed

best regards Stefan