// PIR sensor pin
const int pirPin = 3;
void setup() {
// Initialize serial communication
Serial.begin(9600);
// Configure PIR sensor pin as input
pinMode(pirPin, INPUT);
}
void loop() {
// Read the PIR sensor value
int pirValue = digitalRead(pirPin);
// Check if an object is detected
if (pirValue == HIGH) {
Serial.println("Object detected!");
} else {
Serial.println("No object detected.");
}
// Delay before next reading
delay(1000);
}