// Adapted from ELEGOO Lesson 17. Arduino.h supplies pinMode and digital I/O.
#include <Arduino.h>
// const keeps these pin assignments fixed; uint8_t holds a small unsigned number.
const uint8_t LED_PIN = 13;
const uint8_t PIR_PIN = 7;
// void means this function returns no value. setup runs once after reset.
void setup() {
  pinMode(LED_PIN, OUTPUT);
  pinMode(PIR_PIN, INPUT);  // The powered PIR module already drives its OUT pin.
  digitalWrite(LED_PIN, LOW);
}
// Arduino calls loop repeatedly. HIGH from OUT means detection/hold time is active.
void loop() {
  const int detected = digitalRead(PIR_PIN);
  digitalWrite(LED_PIN, detected);  // Mirror the module, including its retrigger delay.
}
