motion sensor is used to detect the any object

Dependencies:   mbed

Fork of HelloWorld by Simon Ford

main.cpp

Committer:
sumanshavi
Date:
2016-12-01
Revision:
2:e78cebb5a0d5
Parent:
0:fb6bbc10ffa0
Child:
3:085dbf0f0726

File content as of revision 2:e78cebb5a0d5:


#include "mbed.h"
 
DigitalOut buzzer(p19);

DigitalIn motion(p29);  
 int main() {  
 
    wait(2); //Wait for sensor to take snap shot of still room
    
    while(1) {
        if (motion==0){
            buzzer=1;
            wait(2);
        }
        else
            buzzer=0;
            
    }
}