#include <Servo.h>
int servoPin = 3;
Servo Door;
int pirPin = 8;
int val = 0;
void setup() {
pinMode(pirPin,INPUT);
Door.attach(servoPin);
Door.write(90);
}
void loop(){
val = digitalRead(pirPin);
if(val = HIGH){
Door.write(0);
}
else{
Door.write(90);
}
delay(250);
}