const int pirPin = 2;
void setup() {
Serial.begin(9600);
pinMode(pirPin, INPUT);
}
void loop() {
int pirValue = digitalRead(pirPin);
if (pirValue == HIGH) {
Serial.println("Motion detected!");
} else {
Serial.println("No motion detected.");
}
delay(1000);
}