================================================================================
  Experiment 3: ESP32 PIR Motion Detection (Serial Monitor)
================================================================================

FULL QUESTION:
Develop an ESP32 program to detect motion using a PIR sensor and display the detection status using serial communication.

SHORT QUESTION:
ESP32 PIR Motion Detection using Serial Communication.

================================================================================
README & SETUP INSTRUCTIONS:
================================================================================
# Experiment 3: ESP32 PIR Motion Detection

## Objective
Detect human/infrared motion using a PIR sensor module and report motion events over Serial Communication.

## Hardware Wiring
- PIR VCC -> ESP32 3V3
- PIR GND -> ESP32 GND
- PIR OUT -> ESP32 GPIO 27

## How to Run in Wokwi
1. Load `sketch.ino` and `diagram.json` into Wokwi.
2. Start the simulation.
3. In Wokwi, click on the PIR sensor and click "Simulate motion" to trigger `MOTION DETECTED!`.

================================================================================
SOURCE CODE FILES:
================================================================================

1. sketch.ino
--------------------------------------------------------------------------------
#define PIR_PIN 27

void setup() {
  Serial.begin(115200);
  delay(1000);
  pinMode(PIR_PIN, INPUT);
  Serial.println("PIR Motion Detection Initialized.");
}

void loop() {
  int motionStatus = digitalRead(PIR_PIN);

  if (motionStatus == HIGH) {
    Serial.println("MOTION DETECTED!");
  } else {
    Serial.println("No motion.");
  }

  delay(500);
}
--------------------------------------------------------------------------------

2. diagram.json
--------------------------------------------------------------------------------
{
  "version": 1,
  "author": "IoT Lab",
  "editor": "wokwi",
  "parts": [
    { "type": "board-esp32-devkit-c-v4", "id": "esp", "top": 0, "left": 0, "attrs": {} },
    { "type": "wokwi-pir-motion-sensor", "id": "pir1", "top": 0.3, "left": -159, "attrs": {} }
  ],
  "connections": [
    [ "esp:TX", "$serialMonitor:RX", "", [] ],
    [ "esp:RX", "$serialMonitor:TX", "", [] ],
    [ "pir1:GND", "esp:GND.2", "black", [ "v0" ] ],
    [ "pir1:VCC", "esp:3V3", "red", [ "v0" ] ],
    [ "pir1:OUT", "esp:27", "green", [ "v0" ] ]
  ],
  "dependencies": {}
}
--------------------------------------------------------------------------------
