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:
3:085dbf0f0726
Parent:
2:e78cebb5a0d5

File content as of revision 3:085dbf0f0726:


#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==1){
            buzzer=1;
            wait(2);
        }
        else
            buzzer=0;
            
    }
}