Base Code and Citations - leesm5/Arduino-PIR-Motion-Detector GitHub Wiki

Base Code

The code posted below was used as a starting point for this project. His code along with documentation on the HC_SR501 sensor were utilized.

//Henry's Bench
// HC-SR501 Motion Detector
// Sample Sketch

int ledPin = 13;  // LED on Pin 13 of Arduino
int pirPin = 7; // Input for HC-S501

int pirValue; // Place to store read PIR Value

void setup() {

  pinMode(ledPin, OUTPUT);
  pinMode(pirPin, INPUT);
 
  digitalWrite(ledPin, LOW); 
}

void loop() {
  pirValue = digitalRead(pirPin);
  digitalWrite(ledPin, pirValue);
}

Citations

Henrys Bench (accessed 03/03/2017)

The information about the HC-SR501 Motion Detector from Henrys Bench was used in the planning and implementation of this project

MPJA (accessed 03/01/2017)

The official documentation for the HC-SR501 sensor was taken from https://www.mpja.com/download/31227sc.pdf