Lab2_part7_Motor and extra credit (robot)
Fork of 4180lab2_part7_Motor by
Revision 2:fab667092434, committed 2015-10-06
- Comitter:
- ldeng31
- Date:
- Tue Oct 06 19:34:09 2015 +0000
- Parent:
- 1:1997f5ee08bc
- Commit message:
- Lab2 part 7 and extra credit (robot)
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1997f5ee08bc -r fab667092434 main.cpp --- a/main.cpp Sat Sep 05 22:49:48 2015 +0000 +++ b/main.cpp Tue Oct 06 19:34:09 2015 +0000 @@ -3,13 +3,33 @@ #include "mbed.h" #include "Motor.h" -AnalogIn pot(p20); -Motor m(p25, p6, p5); // pwm, fwd, rev +//AnalogIn pot(p20); +//Motor m(p21, p17, p18); // pwm, fwd, rev +Motor mA(p25, p6, p5); // pwm, fwd, rev +Motor mB(p26, p7, p8);//pwm, fwd, rev +DigitalOut STBY(p10); +//Serial pc(USBTX, USBRX); int main() { + STBY = 1; while (true) { - m.speed((pot-1.65f)/1.65f); - wait(0.02); + //pc.printf("analogin%2f\n",pot.read()); + //m.speed((pot.read()-0.5f)/0.5f); + mA.speed(0.5f); + mB.speed(0.5f); + wait(5.0); + mA.speed(-0.5f); + mB.speed(-0.5f); + wait(5.0); + mA.speed(0.5f); + mB.speed(0.0f); + wait(5.0); + mA.speed(0.0f); + mB.speed(0.5f); + wait(5.0); + mA.speed(0.0f); + mB.speed(0.0f); + wait(1.0); } } \ No newline at end of file