DCmotor rotation depends on pin switch

Dependencies:   mbed

Fork of HelloWorld by Simon Ford

DCmotor.cpp

Committer:
goutami
Date:
2016-11-25
Revision:
2:2187486a8fea

File content as of revision 2:2187486a8fea:

#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);
    }
}