Simon Ford
/
Motor_HelloWorld
Hello World for a simple motor driver class, used to control an H-Bridge with PwmOut and 2 DigitalOuts
Revision 0:7bbc230e00d6, committed 2010-11-23
- Comitter:
- simon
- Date:
- Tue Nov 23 16:19:19 2010 +0000
- Commit message:
- Use Motor library
Changed in this revision
diff -r 000000000000 -r 7bbc230e00d6 Motor.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Motor.lib Tue Nov 23 16:19:19 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/Motor/#f265e441bcd9
diff -r 000000000000 -r 7bbc230e00d6 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Nov 23 16:19:19 2010 +0000 @@ -0,0 +1,13 @@ +// Sweep the motor speed from full-speed reverse (-1.0) to full speed forwards (1.0) + +#include "mbed.h" +#include "Motor.h" + +Motor m(p23, p6, p5); // pwm, fwd, rev + +int main() { + for (float s= -1.0; s < 1.0 ; s += 0.01) { + m.speed(s); + wait(0.02); + } +}
diff -r 000000000000 -r 7bbc230e00d6 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Nov 23 16:19:19 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e