Goutami Bhat
/
DCmotor
DCmotor rotation depends on pin switch
Fork of HelloWorld by
Diff: DCmotor.cpp
- Revision:
- 2:2187486a8fea
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DCmotor.cpp Fri Nov 25 16:58:29 2016 +0000 @@ -0,0 +1,19 @@ +#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); + } +} \ No newline at end of file