Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Re: Reaction Test on: December 28, 2012, 01:37:34 pm
Thanks il rectify the code and see if it works smiley ta
2  Using Arduino / Programming Questions / Reaction Test on: December 28, 2012, 12:56:38 pm
Hey.
Im new to this arduino stuff and i'm sitting on some code that i think should work. the idea is sort of a reaction tester where a red LED blinks on for one second with random intervals. if a button is pressed while the red LED is still on the red LED turns off and a green one goes on.

can anyone help and point out where i've gone wrong. :/
Code:
int Correct=12;
int LED=2;
int Button=4;

void setup()
{
 pinMode(Correct, OUTPUT);
 pinMode(LED, OUTPUT);
 pinMode(Button, INPUT);
}

void loop()
{
   if(digitalRead(LED,HIGH);
  {
     if(digitalRead(Button,HIGH))
  {
    digitalWrite(LED,LOW);
    digitalWrite(Correct,HIGH);
    delay(2000)
    digitalWrite(Correct,LOW);
  };
  };
 
 delay(random(2000,4000));
  digitalWrite(LED,HIGH);
  delay(1000);
  digitalWrite(LED,LOW);
};

when i go to compile it just points me at this line
if(digitalRead(LED, HIGH);
{
...
}


Any help would be appreciated  smiley


Moderator edit: [code] [/code] tags added.
Pages: [1]