Niranjan Ravi / Mbed 2 deprecated frdm_proximity

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 Serial pc(USBTX, USBRX); // tx, rx
00003 DigitalOut led(LED1);
00004 DigitalIn pir(D2);   //Connect it to 
00005 Timer timer;
00006  
00007 int main()
00008 {
00009         while(1) {
00010             if(!pir){
00011                 led = 0;
00012                 pc.printf("Nothing Detected\r\n");
00013                 wait(1);
00014                 }
00015         else {
00016             led=1;
00017             pc.printf("Motion Detected\r\n");
00018             wait(1);
00019         }
00020     }
00021 }