I want to make a led turn on when I clap but I don t know how t.o code it. HELP!

int LED = 9; int sensor; void setup() { // put your setup code here, to run once: pinMode( LED, OUTPUT);

}

void loop() { // put your main code here, to run repeatedly: int sensor= analogRead(A0)

if digitalRead( sensor > 400);

{ digitalWrite( LED, HIGH); delay(5000); } else digitalWrite( LED, LOW); } }

Looks like you pretty much got it - assuming that analogRead works with a 400 threshold.

However, this:

  if digitalRead( sensor > 400);

Has a number of problems. Better:

  if( sensor > 400)

Note that not only is the digitalRead gone, so is the semicolon.

wildbill: Looks like you pretty much got it

Well maybe. The guy hasn't told us anything about what is connected to this arduino or really anything except for the code. If he's just got the code running and nothing connected there then it certainly won't work.

I don't understand why people want to post to ask for help and then give absolutely no details about what they are trying to do whatsoever.