DCmotor rotation depends on pin switch

Dependencies:   mbed

Fork of HelloWorld by Simon Ford

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers DCmotor.cpp Source File

DCmotor.cpp

00001 #include "Dcmotor.h"
00002 #include "mbed.h"
00003  
00004 Dcmotor::Dcmotor(PinName1 pin1,PinName2 pin2) : pins(pin1,pin2) {
00005     pins = 0;
00006 }
00007  
00008 void Dcmotor::Dc() {
00009     if(pinnm==0)
00010     {
00011         pins=1;
00012         wait(0.2);
00013     }
00014     if(pinnm==1)
00015     {
00016         pins=2;
00017         wait(0.2);
00018     }
00019 }