//Connect ALL the expected conenctions properly, including the SERVO MOTORS
//Construct it such that if the PIR detects motion, the LED lights up and the SERVOs move.
//Add the ecessary codes, especially on to SERVOs.
#include <Servo.h>
Servo servo1;
Servo servo2;
Servo servo3;
int servopin1 = 9;
int servopin2 = 10;
int servopin3 = 11;
int ledred = 13;
int PIRsensor = 8;
boolean start = false;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode (ledred, OUTPUT);
pinMode (PIRsensor, INPUT);
servo1.attach(servopin1);
servo2.attach(servopin2);
servo3.attach(servopin3);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(PIRsensor) == HIGH) {
digitalWrite (ledred, HIGH);
Serial.println("Motion deotected");
servo1.write(180);
servo2.write(180);
servo3.write(180);
}
else {
digitalWrite (ledred, LOW);
Serial.println("Motion stopped.");
servo1.write(0);
servo2.write(0);
servo3.write(0);
}
}