2 proximity sensors and 1 servo


#include <Servo.h>

int tmp1 = 0;

int sensorA = 5;
int sensorB = 6;

Servo myservoA;

void setup() {
  Serial.begin(9200);

  pinMode(sensorA, INPUT);  
  digitalWrite(sensorA, LOW);

  pinMode(sensorB, INPUT);  
  digitalWrite(sensorB, LOW);


  myservoA.attach(10);

  tmp1 = myservoA.read();
}

void loop() {
  if(digitalRead(sensorA) == LOW || digitalRead(sensorB) == LOW){
    Serial.println("DETECTED (A)");
    for (tmp1 = myservoA.read(); tmp1 <= 180; tmp1 += 1) {
      myservoA.write(tmp1);
      delay(5);
    }
  }else{
    Serial.println("NOT DETECTED (A)");
    myservoA.write(0);
    delay(5);
  }


}