motor

Dependencies:   Motor mbed

Fork of Motor_HelloWorld by Simon Ford

Committer:
ycai47
Date:
Sat Sep 05 22:49:48 2015 +0000
Revision:
1:1997f5ee08bc
Parent:
0:7bbc230e00d6
motor

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 0:7bbc230e00d6 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
ycai47 1:1997f5ee08bc 6 AnalogIn pot(p20);
ycai47 1:1997f5ee08bc 7 Motor m(p25, p6, p5); // pwm, fwd, rev
simon 0:7bbc230e00d6 8
simon 0:7bbc230e00d6 9 int main() {
ycai47 1:1997f5ee08bc 10 while (true)
ycai47 1:1997f5ee08bc 11 {
ycai47 1:1997f5ee08bc 12 m.speed((pot-1.65f)/1.65f);
simon 0:7bbc230e00d6 13 wait(0.02);
simon 0:7bbc230e00d6 14 }
ycai47 1:1997f5ee08bc 15 }