// Define the pins for LED and PIR sensor
#define LED_PIN 13
#define PIR_PIN 2
void setup() {
pinMode(LED_PIN, OUTPUT); // Set the LED pin as output
pinMode(PIR_PIN, INPUT); // Set the PIR pin as input
}
void loop() {
int pirValue = digitalRead(PIR_PIN); // Read the PIR sensor
if(pirValue == HIGH) { // If motion is detected
digitalWrite(LED_PIN, HIGH); // Turn ON the LED
} else { // If no motion is detected
digitalWrite(LED_PIN, LOW); // Turn OFF the LED
}
}