-
Notifications
You must be signed in to change notification settings - Fork 3
PIR
Guillaume VILLEREZ edited this page Feb 14, 2016
·
1 revision
https://learn.adafruit.com/downloads/pdf/pir-passive-infrared-proximity-motion-sensor.pdf
(Using wiringPi)
The PIR sensor is the easiest to use, because it will set its GPIO pin to HIGH when anything is detected, and to LOW when nothing is detected :
int readPir(int pin) {
// Prepare to read the pin
pinMode(pin, INPUT);
// Read the pin
uint8_t state = digitalRead(pin);
if(state == HIGH)
return 1;
else
return 0;
}