IR sensor program

hello,
i am making an automatic street light controller using ir sensor.
in my project i have 4 ir sensor and 5 power LED(will act as street light).I gave the 5v input to the IR sensors from arduino 5v pin (to all 4 sensor). and connected the led to the respective digital pins. but i tried to upload the code the code wasn't uploading.
Next what i did :
i took the supply from external source and gave it 5v and gnd of the sensors. and nly connect the out of ir sensor to arduino. Even the Power led i connected through Transistor such that base was given to transistor, collector to external supply, and emitter the power led and other pin of led to gnd. still i had the same problem

this is my code
#define IR1 1
#define IR2 2
#define IR3 3
#define IR4 4
int detection1; // no obstacle
int detection2;
int detection3;
int detection4;
int ledPin1 = 6;
int ledPin2 = 7;
int ledPin3 = 8;
int ledPin4 = 8;
int ledPin5 = 9;
int Value1=10;
int Value2=50;
void setup()
{
Serial.begin(9600);
pinMode(IR1, INPUT);
pinMode(IR2, INPUT);
pinMode(IR3, INPUT);
pinMode(IR4, INPUT);
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
pinMode(ledPin5, OUTPUT);
}
void loop() {
detection1 = digitalRead(IR1);
detection2 = digitalRead(IR2);
detection3 = digitalRead(IR3);
detection4 = digitalRead(IR4);
analogWrite(ledPin1, Value1);
analogWrite(ledPin2, Value1);
analogWrite(ledPin3, Value1);
analogWrite(ledPin4, Value1);
analogWrite(ledPin5, Value1);
if(detection1 == LOW)
{
analogWrite(ledPin1, Value1);
}
else
{
analogWrite(ledPin1, Value2);
analogWrite(ledPin2, Value2);

}
if(detection2 == LOW)
{
//analogWrite(ledPin2, Value1);
}
else
{
analogWrite(ledPin1, Value2);
analogWrite(ledPin3, Value2);
analogWrite(ledPin2, Value2);
}
if(detection3 == LOW)
{
//analogWrite(ledPin2, Value1);
}
else
{
analogWrite(ledPin4, Value2);
analogWrite(ledPin3, Value2);
analogWrite(ledPin2, Value2);
}
if(detection4 == LOW)
{
//analogWrite(ledPin2, Value1);
}
else
{
analogWrite(ledPin4, Value2);
analogWrite(ledPin3, Value2);
analogWrite(ledPin5, Value2);
}
delay(100); // in ms
}