// Pin definition
const int pirPin = 26; // GPIO pin connected to the PIR sensor OUT pin
void setup() {
// Initialize the PIR sensor pin as an INPUT
pinMode(pirPin, INPUT);
// Start the Serial communication
Serial.begin(115200);
}
void loop() {
// Read the PIR sensor output
int motionDetected = digitalRead(pirPin);
// Check if motion is detected
if (motionDetected == HIGH) {
Serial.println("Motion detected!");
} else {
Serial.println("No motion detected.");
}
delay(1000); // Delay for 1 second before checking again
}