#include <Buzzer.h>
const int buzzPin = 8;
const int pirPin = 12;
void setup() {
pinMode(pirPin, INPUT);
Serial.begin(9600);
}
void loop() {
int motionVal = digitalRead(pirPin);
if(motionVal == HIGH) {
Serial.println("Motion detected");
tone(buzzPin, 50);
delay(100);
noTone(buzzPin);
delay(50);
} else {
Serial.println("No motion detected");
}
delay(1000);
}