int doorSensor = 5;
doorSensor variable get assigned value 5
pinMode(doorSensor, INPUT);
Pin 5 is configured as input
if (doorSensor == true){
Serial.println("Door Sensor True");
digitalWrite(mainLightOn, HIGH);
delay(1500);
digitalWrite(mainLightOn, LOW);
goto back;
}
I don't see how can this works comparing doorSensor which have a value of 5, since a boolean state is always true to a value different from 0.
This if is will always be running since 5 is different from 0 and so considerer true!!