Tyfighters
/
MotorsCode
working
main.cpp
- Committer:
- m175694
- Date:
- 2014-10-16
- Revision:
- 1:214c872ef845
- Parent:
- 0:833afd26d33b
File content as of revision 1:214c872ef845:
#include "mbed.h" #include "Motor.h" float motspeed=.3; int count = 0; int notdone=1; int i; int count2 = 0; DigitalIn sw1(p16); int main() { Motor m(p26,p29,p30); while(1) { while (count < 10 && sw1 !=0) { m.speed(motspeed); wait(.08); m.speed(0.0); wait(.3); count ++; } while (count2 < 10 && sw1 !=0) { m.speed(-motspeed); wait(.08); m.speed(0.0); wait(.3); count2 ++; } count=0; count2=0; if(sw1==0) { } } }