#include <Servo.h>
int pirPin=12;
int ledPin=8;
int buzzPin=6;
int servoPin=3;
int angle=0;
Servo servo;
void setup(){
pinMode(pirPin,INPUT);
pinMode(ledPin,OUTPUT);
pinMode(buzzPin,OUTPUT);
servo.attach(servoPin);
}
void loop(){
int pirState=digitalRead(pirPin);
if (pirState==HIGH){
digitalWrite(ledPin,HIGH);
tone(buzzPin,1000);
servo.write(90);
delay(5000);
servo.write(0);
delay(5000);
}
if(pirState==LOW){
digitalWrite(ledPin,LOW);
noTone(buzzPin);
servo.write(0);
}
}