4180 LabTeam - Spring '18
/
Motor_HelloWorld
4180 H-Bridge motor
Fork of Motor_HelloWorld by
Diff: main.cpp
- Revision:
- 1:159946ba2b28
- Parent:
- 0:7bbc230e00d6
diff -r 7bbc230e00d6 -r 159946ba2b28 main.cpp --- a/main.cpp Tue Nov 23 16:19:19 2010 +0000 +++ b/main.cpp Wed Mar 07 03:04:22 2018 +0000 @@ -3,11 +3,14 @@ #include "mbed.h" #include "Motor.h" -Motor m(p23, p6, p5); // pwm, fwd, rev +Motor m(p23, p12, p11); // pwm, fwd, rev +AnalogIn pot(p15); int main() { - for (float s= -1.0; s < 1.0 ; s += 0.01) { - m.speed(s); - wait(0.02); + float s; + while(1){ + s = (pot*2)-1; + m.speed(s); + wait(0.01); } }