ECE4180
/
4180lab2_part7_Motor
motor
Fork of Motor_HelloWorld by
Revision 1:1997f5ee08bc, committed 2015-09-05
- Comitter:
- ycai47
- Date:
- Sat Sep 05 22:49:48 2015 +0000
- Parent:
- 0:7bbc230e00d6
- Commit message:
- motor
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 7bbc230e00d6 -r 1997f5ee08bc main.cpp --- a/main.cpp Tue Nov 23 16:19:19 2010 +0000 +++ b/main.cpp Sat Sep 05 22:49:48 2015 +0000 @@ -3,11 +3,13 @@ #include "mbed.h" #include "Motor.h" -Motor m(p23, p6, p5); // pwm, fwd, rev +AnalogIn pot(p20); +Motor m(p25, p6, p5); // pwm, fwd, rev int main() { - for (float s= -1.0; s < 1.0 ; s += 0.01) { - m.speed(s); + while (true) + { + m.speed((pot-1.65f)/1.65f); wait(0.02); } -} +} \ No newline at end of file