Help in automatic speed-based lights. EDIT (Receiving a compiling error, solved)

Hi guys! This is my first ever post here and my first ever program, so bear with me.

I'm trying to turn on a light by using an infrared sensor to find the speed of a car, and turn on a light if it is speeding to let the driver know.

I * a cough* tried cough :fearful: :o to write a code, but it is not working(getting a "expected '(' before ';' token' error") and I need some help.

Here is my code:

int timer=0;
int IRPin=9;
int obstacle=HIGH;
int T;
int MS;
int LED=5;
int KMPH; 
unsigned long currentMillis;
void setup() {
  // put your setup code here, to run once:
pinMode(IRPin, INPUT); //Defining inputs and outputs
pinMode(LED, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
if (obstacle == LOW;) {  //Means there is an obstacle
  currentMillis = millis(); //Start timer
    
  }
}
if (obstacle == HIGH;){ //No more obstacle

  
}


MS=40/currentMillis; //Divide current time and pre-set distance to get meters per second
KMPH=MS*3.6; //convert to KMH

if (KMPH >= 40){
  digitalWrite(LED, HIGH);
}
}

All help appreciated, thanks in advance!

EDIT: Added my error name, as I forgot to.

 if (obstacle == LOW;) {  //  );  semicolon ends statement Should be );
} // this bracket ends the loop() function.   Remove it
if (obstacle == HIGH;) // same error as before  Should be );{ //No more obstacle

Fix those errors and it will compile. Whether it does what you want or not, I don't know.

If your code will not compile, say so. The hated phrase "it does not work" conveys no useful information.

groundFungus:

 if (obstacle == LOW;) {  //  );  semicolon ends statement Should be );
} // this bracket ends the loop() function.   Remove it

if (obstacle == HIGH;) // same error as before  Should be );{ //No more obstacle




Fix those errors and it will compile. Whether it does what you want or not, I don't know.

If your code will not compile, say so. The hated phrase "it does not work" conveys no useful information.

Thanks a lot! It compiled. Whether it works or not, will have to wait till a receive my sensor shipment.

As for the 'does not work', sorry about that! I completely forgot. I've added it now, and I will post an update on whether it works.

Once again, thanks!