Working PIR sensor

Dependencies:   mbed

main.cpp

Committer:
vazbyte
Date:
2019-01-31
Revision:
1:f6f524d2dc18
Parent:
0:61201dd6e178
Child:
2:7844d0880ba7

File content as of revision 1:f6f524d2dc18:

#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;
    }
}