need help

this is my first project and I'm having trouble making this code work properly coul anyone help me

void setup() {
const int PingPin = 7;
const int echoPin = 6;
const int led = 8;
Serial.begin(9600);
}

void loop()
{
const int PingPin = 7;
const int echoPin = 6;
const int led = 8;
long duration, inches, cm;
pinMode(PingPin, OUTPUT);
digitalWrite(PingPin, LOW);
delayMicroseconds(2);
digitalWrite(PingPin, HIGH);
delayMicroseconds(10);
digitalWrite(PingPin, LOW);
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.print("cm");
void serialEvent();
if (Serial.read) = >(61in 156cm);
digitalWrite (led, LOW);
else;
digitalWrite (led, HIGH);

delay(100);
}
long microsecondsToInches(long microseconds) {
return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds) {
return microseconds / 29 / 2;
}


(mod edit)
The code Auto Formatted in the IDE and posted in code tags
See Read this before posting a programming question

void setup()
{
  const int PingPin = 7;
  const int echoPin = 6;
  const int led = 8;
  Serial.begin(9600);
}

void loop()
{
  const int PingPin = 7;
  const int echoPin = 6;
  const int led = 8;
  long duration, inches, cm;
  pinMode(PingPin, OUTPUT);
  digitalWrite(PingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(PingPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(PingPin, LOW);
  pinMode(echoPin, INPUT);
  duration = pulseIn(echoPin, HIGH);
  inches = microsecondsToInches(duration);
  cm = microsecondsToCentimeters(duration);
  Serial.print(inches);
  Serial.print("in, ");
  Serial.print(cm);
  Serial.print("cm");
  void serialEvent();
  if (Serial.read) = > (61in 156cm);
  digitalWrite (led, LOW);
  else;
  digitalWrite (led, HIGH);
  delay(100);
}

long microsecondsToInches(long microseconds)
{
  return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds)
{
  return microseconds / 29 / 2;
}

(deleted)

its supposed to trigger an led when the sensor is within 5 feet of an object the sensor works distance wise
but I cant get it to trigger the led

I think you have an issue on reading the value from ultrasonic sensor. Compare your code with code in Arduino - Ultrasonic Sensor triggers LED tutorial

if (Serial.read) = >(61in 156cm);
digitalWrite (led, LOW);
else;
digitalWrite (led, HIGH);

Suggest you check the syntax for if...else... statements.

what part do i need to change?

ksl_tek:
what part do i need to change?

Just about all of it.
Did you read the page I linked to? Does your syntax like the syntax provided there? For example…

 if (temperature >= 70) {
  // Danger! Shut down the system.
}
else if (temperature >= 60) { // 60 <= temperature < 70
  // Warning! User attention required.
}
else { // temperature < 60
  // Safe! Continue usual tasks.
}
  1. “if (…)” and “else” should not end with a semicolon. A semicolon there ends the if or else clause and the following line of code is NOT part of the if/else.
  2. The whole “if” condition goes in the brackets after the “if”. The brackets are a mandatory part of the “if” statement. You appear to be making up syntax here.
  3. I have no idea why you are trying to do a serial read when you presumably want to toggle the LED based on the value of a variable (either “cm” or “inches”).
  4. I recommend braces { } for the “if” and “else” code blocks (as illustrated) so there is no confusion about what is and is not in the code block.

thank you and i did read it

 if (Serial.read) = > (61in 156cm);
  digitalWrite (led, LOW);
  else;
  digitalWrite (led, HIGH);

Read up on how to use if/else :

Do not end the if line with a semicolon otherwise it is the only code executed conditionally based on the test
nor the else line for that matter
Use curly brackets to denote code blocks even if there is only one line of code

  if (Serial.read) = > (61in 156cm)
  {
    digitalWrite (led, LOW);
  }
  else
  {
    digitalWrite (led, HIGH);
  }