DC motor control using pot

Dependencies:   Motor mbed

Fork of Motor_HelloWorld by Simon Ford

Committer:
kzar
Date:
Tue Oct 16 19:02:00 2018 +0000
Revision:
1:53fc5a32c407
Parent:
0:7bbc230e00d6
DC motor control using pot

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kzar 1:53fc5a32c407 1 // Sweep the motor speed from full-speed reverse (-1.0) to full speed forwards (1.0)
simon 0:7bbc230e00d6 2
simon 0:7bbc230e00d6 3 #include "mbed.h"
simon 0:7bbc230e00d6 4 #include "Motor.h"
simon 0:7bbc230e00d6 5
kzar 1:53fc5a32c407 6 AnalogIn pot(p19);
kzar 1:53fc5a32c407 7 Motor m(p25, p6, p5); // pwm, fwd, rev
simon 0:7bbc230e00d6 8
simon 0:7bbc230e00d6 9 int main() {
kzar 1:53fc5a32c407 10 while (1) {
kzar 1:53fc5a32c407 11 m.speed((pot*2)-1);
simon 0:7bbc230e00d6 12 }
simon 0:7bbc230e00d6 13 }