Hello World for a simple motor driver class, used to control an H-Bridge with PwmOut and 2 DigitalOuts

Dependencies:   mbed Motor

Committer:
simon
Date:
Tue Nov 23 16:19:19 2010 +0000
Revision:
0:7bbc230e00d6
Use Motor library

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
simon 0:7bbc230e00d6 6 Motor m(p23, p6, p5); // pwm, fwd, rev
simon 0:7bbc230e00d6 7
simon 0:7bbc230e00d6 8 int main() {
simon 0:7bbc230e00d6 9 for (float s= -1.0; s < 1.0 ; s += 0.01) {
simon 0:7bbc230e00d6 10 m.speed(s);
simon 0:7bbc230e00d6 11 wait(0.02);
simon 0:7bbc230e00d6 12 }
simon 0:7bbc230e00d6 13 }