const int pirPin = 3; // PIR sensor output pin
const int ledPin = 2; // LED pin
const int buzzerPin = 4; // Buzzer pin
void setup() {
pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
}
void loop() {
int pirValue = digitalRead(pirPin);
if (pirValue == HIGH) {
digitalWrite(ledPin, HIGH);
digitalWrite(buzzerPin, HIGH);
delay(2000); // Buzzer ON for 1 second
digitalWrite(buzzerPin, LOW);
} else {
digitalWrite(ledPin, LOW);
}
delay(2000);
}