#include <Servo.h>
int pir=3;
int led1=7;
int led2=6;
int ServoPin=4;
int detect=0;
int buzzer=8;
Servo myServo;
void setup() {
  pinMode(pir, INPUT);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(buzzer, OUTPUT);
  Serial.begin(115200);
  myServo.attach(ServoPin);
  myServo.write(0);
}

void loop() {
  detect=digitalRead(pir);
  if(detect==HIGH)
  {
    tone(buzzer,2000);
    delay(200);
    digitalWrite(led1, HIGH);
    noTone(buzzer);
    myServo.write(100);
    delay(10000);
    digitalWrite(led1, LOW);
    myServo.write(0);
  }
  else{
    myServo.write(0);
    digitalWrite(led1, LOW);
    delay(1000);
    digitalWrite(led2, HIGH);
    delay(150);
    digitalWrite(led2, LOW);
  }
}