int p1=13;
int p2=5;
int p3=9;
void setup() {
  // put your setup code here, to run once:
  pinMode(p1, OUTPUT);
  pinMode(p2, INPUT);
  pinMode(p3, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  if(digitalRead(p2)==0){
    digitalWrite(p1,LOW);
    digitalWrite(p3, HIGH);
    delay(500);
    Serial.println("Obstacle Detected");
  }
  else{
    digitalWrite(p1,HIGH);
    digitalWrite(p3, LOW);
    // Serial.println("No");
    delay(100);
  }
}