void setup() {
  
  pinMode(16, INPUT);
  pinMode(17,OUTPUT);
  Serial.begin(9600);
  
}

void loop() {
  
 int x = digitalRead(16);
 if(x==1){
  digitalWrite(17, HIGH);
  Serial.println("Object Detected");
  delay(1000); 
 }
 else{
  digitalWrite(17, LOW);
  Serial.println("Object Not Detected");
  delay(1000);
 }

}