Working PIR sensor

Dependencies:   mbed

main.cpp

Committer:
vazbyte
Date:
2019-01-31
Revision:
2:7844d0880ba7
Parent:
1:f6f524d2dc18

File content as of revision 2:7844d0880ba7:

#include "mbed.h"
 
DigitalOut led1(LED1);
DigitalIn alarm(p29, PullNone); //internal pull up 
 
int main() {  
    wait(2); //Wait for sensor to take snap shot of still room
    
    while(1) {
        if (!alarm){
            led1 = 1;
            wait(2);
        }
        else
            led1 = 0;
    }
}