#include <Servo.h>
Servo myservo;
// define which pin each part is connected to
int LED = 5;
int MOTION = 3;
void setup() {
// set the led to output and motion sensor to input
pinMode(LED, OUTPUT);
pinMode(MOTION, INPUT);
myservo.attach(11);
}
void loop() {
int motionValue = digitalRead(MOTION);
if (motionValue == HIGH) {
digitalWrite(LED, HIGH);
myservo.write(90);
}
else if (motionValue == LOW) {
digitalWrite(LED, LOW);
myservo.write(0);
}
}