#include <Servo.h>
Servo myServo;
int motionPin = 2;
void setup(){
pinMode(motionPin, INPUT);
myServo.attach(9);
Serial.begin(9600);
}
void loop()
{
int readValue = digitalRead(motionPin);
if (readValue == HIGH){
myServo.write(90 );
}
else{
myServo.write(0);
}
delay(10);
}