smart street light using arduino by 5 ir sensors

int led = 3;
int led1 = 10;
int led2 = 5;
int led3 = 6;
int led4 = 9;

int ldr = A0;

int x1, x2, x3, x4,x5;

void setup()
{
Serial.begin (9600);
pinMode (led,OUTPUT);
pinMode (led1,OUTPUT);
pinMode (led2,OUTPUT);
pinMode (led3,OUTPUT);
pinMode (led4,OUTPUT);

pinMode (ldr,INPUT);

}
void loop()
{

int ldrStatus = analogRead (ldr);
if (ldrStatus <=300)
{
//digitalWrite(led, HIGH);
//analogWrite(led,255/5);

// digitalWrite(led1, HIGH);
// analogWrite(led1,255/5);

// digitalWrite(led2, HIGH);
// analogWrite(led2,255/5);

//digitalWrite(led3, HIGH);
//analogWrite(led3,255/5);

// digitalWrite(led4, HIGH);
// analogWrite(led4,255/5);

/*Serial.print("A1");
Serial.println(analogRead(A1));
Serial.print("A2");
Serial.println(analogRead(A2));
Serial.print("A3");
Serial.println(analogRead(A3));
Serial.print("A4");
Serial.println(analogRead(A4));

Serial.print("A5");
Serial.println(analogRead(A5));*/

if (analogRead(A1)<500) // IR 1 CODE
{
x1=0;
x2=1;

digitalWrite(led,HIGH);

digitalWrite(led1,HIGH);
delay(100);// micro second

}
else
{
if(x1==0){
digitalWrite(led,HIGH);
analogWrite(led,255/5);
delay(50);
}
}

if (analogRead(A2)<500) // IR 2 CODE
{
x2=0;
x3=1;
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
delay(100);// micro second
}
else
{
if(x2==0)
{
digitalWrite(led1,HIGH);
analogWrite(led1,255/5);
delay(50);

}
}

if (analogRead(A3)<500) // IR 3 CODE
{
x3=0;
x4=1;
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
delay(100);// micro second
}
else
{
if(x3==0)
{
digitalWrite(led2,HIGH);
analogWrite(led2,255/5);
delay(50);
}
}

if (analogRead(A4)<500) // IR 4 CODE
{
x4=0;
digitalWrite(led3,HIGH);
delay(100);// micro second
}
else
{
if(x4==0){

digitalWrite(led3,HIGH);
analogWrite(led3,255/5);
delay(50);

}
}

if (analogRead(A5)<500) // IR 5 CODE
{
x1=1;
digitalWrite(led4,HIGH);

digitalWrite(led,HIGH);

delay(100);// micro second
}
else
{
digitalWrite(led4,HIGH);
analogWrite(led4,255/5);
delay(50);

}
}
else
{
digitalWrite(led, LOW);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
}

}

is my program is correct
if not edit it
thank you

is my program is correct

How can we know that? You are the only one, at this point, that knows what it is supposed to do.

if not edit it

Even if we knew what the program is supposed to do, we don't write your code for you.

Describe what the code actually does and how that differs from what you want it to do and we can help make it right.

Read the how to use this forum sticky to see how to properly post code and some advice on how to get the most from the forum.

int x1, x2, x3, x4,x5;

These names might mean something to you. They don't mean squat to me. It is impossible to tell whether the code is correct, when it contains meaningless names.

It compiles and you've given no idea what it's supposed to do so as far as I can tell it's fine.

Steve

Here as a public service is the OP's code control-T'd and code tagged:

int led = 3;
int led1 = 10;
int led2 = 5;
int led3 = 6;
int led4 = 9;

int ldr = A0;

int x1, x2, x3, x4, x5;

void setup()
{
  Serial.begin (9600);
  pinMode (led, OUTPUT);
  pinMode (led1, OUTPUT);
  pinMode (led2, OUTPUT);
  pinMode (led3, OUTPUT);
  pinMode (led4, OUTPUT);

  pinMode (ldr, INPUT);

}
void loop()
{

  int ldrStatus = analogRead (ldr);
  if (ldrStatus <= 300)
  {
    //digitalWrite(led, HIGH);
    //analogWrite(led,255/5);

    //  digitalWrite(led1, HIGH);
    // analogWrite(led1,255/5);

    // digitalWrite(led2, HIGH);
    // analogWrite(led2,255/5);

    //digitalWrite(led3, HIGH);
    //analogWrite(led3,255/5);

    // digitalWrite(led4, HIGH);
    // analogWrite(led4,255/5);

    /*Serial.print("A1");
           Serial.println(analogRead(A1));
      Serial.print("A2");
           Serial.println(analogRead(A2));
       Serial.print("A3");
           Serial.println(analogRead(A3));
          Serial.print("A4");
           Serial.println(analogRead(A4));

           Serial.print("A5");
           Serial.println(analogRead(A5));*/


    if (analogRead(A1) < 500)     // IR 1 CODE
    {
      x1 = 0;
      x2 = 1;

      digitalWrite(led, HIGH);

      digitalWrite(led1, HIGH);
      delay(100);// micro second

    }
    else
    {
      if (x1 == 0) {
        digitalWrite(led, HIGH);
        analogWrite(led, 255 / 5);
        delay(50);
      }
    }

    if (analogRead(A2) < 500)         // IR 2 CODE
    {
      x2 = 0;
      x3 = 1;
      digitalWrite(led1, HIGH);
      digitalWrite(led2, HIGH);
      delay(100);// micro second
    }
    else
    {
      if (x2 == 0)
      {
        digitalWrite(led1, HIGH);
        analogWrite(led1, 255 / 5);
        delay(50);

      }
    }

    if (analogRead(A3) < 500)         // IR 3 CODE
    {
      x3 = 0;
      x4 = 1;
      digitalWrite(led2, HIGH);
      digitalWrite(led3, HIGH);
      delay(100);// micro second
    }
    else
    {
      if (x3 == 0)
      {
        digitalWrite(led2, HIGH);
        analogWrite(led2, 255 / 5);
        delay(50);
      }
    }

    if (analogRead(A4) < 500)     // IR 4 CODE
    {
      x4 = 0;
      digitalWrite(led3, HIGH);
      delay(100);// micro second
    }
    else
    {
      if (x4 == 0) {


        digitalWrite(led3, HIGH);
        analogWrite(led3, 255 / 5);
        delay(50);

      }
    }

    if (analogRead(A5) < 500)      // IR 5 CODE
    {
      x1 = 1;
      digitalWrite(led4, HIGH);

      digitalWrite(led, HIGH);

      delay(100);// micro second
    }
    else
    {
      digitalWrite(led4, HIGH);
      analogWrite(led4, 255 / 5);
      delay(50);

    }
  }
  else
  {
    digitalWrite(led, LOW);
    digitalWrite(led1, LOW);
    digitalWrite(led2, LOW);
    digitalWrite(led3, LOW);
    digitalWrite(led4, LOW);
  }

}