#define PIR_PIN_1 6 // Replace with the actual pins connected to the PIR sensors
#define PIR_PIN_2 5
#define PIR_PIN_3 4
#define LED_PIN_1 12 // Replace with the actual pins connected to the LEDs
#define LED_PIN_2 11
#define LED_PIN_3 10
void setup() {
Serial.begin(9600);
pinMode(PIR_PIN_1, INPUT);
pinMode(PIR_PIN_2, INPUT);
pinMode(PIR_PIN_3, INPUT);
pinMode(LED_PIN_1, OUTPUT);
pinMode(LED_PIN_2, OUTPUT);
pinMode(LED_PIN_3, OUTPUT);
}
void loop() {
int pirState1 = digitalRead(PIR_PIN_1);
int pirState2 = digitalRead(PIR_PIN_2);
int pirState3 = digitalRead(PIR_PIN_3);
// Control the LEDs based on PIR sensor readings
digitalWrite(LED_PIN_1, pirState1);
digitalWrite(LED_PIN_2, pirState2);
digitalWrite(LED_PIN_3, pirState3);
if (pirState1 == HIGH && pirState2 == HIGH && pirState3 == HIGH) {
// Motion detected by all three sensors
Serial.println("Motion Detected");
delay(2000); // Delay to prevent multiple detections within a short time
}
else {
// no motion detected
Serial.println("No Motion Detected");
delay(2000);
}
}