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

Dependencies:   mbed Motor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 // Sweep the motor speed from full-speed reverse (-1.0) to full speed forwards (1.0)
00002 
00003 #include "mbed.h"
00004 #include "Motor.h"
00005 
00006 Motor m(p23, p6, p5); // pwm, fwd, rev
00007 
00008 int main() {
00009     for (float s= -1.0; s < 1.0 ; s += 0.01) {
00010        m.speed(s); 
00011        wait(0.02);
00012     }
00013 }