This is the application of d.c motor as a hand dryer .

Dependencies:   mbed

main.cpp

Committer:
Akshayiupui
Date:
2016-05-07
Revision:
0:5d05007d486e

File content as of revision 0:5d05007d486e:

#include "mbed.h"
InterruptIn motion(PTB9);
DigitalOut vcc(PTC16);
int motion_detected = 0;
int l=1;
void irq_handler(void)
{   
    motion_detected = 1;
}
    
int main(void)
{  
    motion.rise(&irq_handler);
   
    while(1) {
           if(motion_detected==1){ 
       motion_detected = 0;
        l++;
           if(l==3){printf("Motor is working\n");
               vcc=!vcc;}
           if(l==6){vcc=0;
           l=0;}
           }
    }
}