DC_Motor_rotation using switch

Dependencies:   mbed

Fork of HelloWorld by Simon Ford

DC_Motor.cpp

Committer:
deepakdtelgar
Date:
2016-12-01
Revision:
2:1e23df59fc31

File content as of revision 2:1e23df59fc31:

#include "Dcmotor.h"
#include "mbed.h"
 
Dcmotor::Dcmotor(PinName1 pin1,PinName2 pin2) : pins(pin1,pin2) {
    pins = 0;
}
 
void Dcmotor::Dc() {
    if(pinnm==0)
    {
        pins=1;
        wait(0.2);
    }
    if(pinnm==1)
    {
        pins=2;
        wait(0.2);
    }
}