Simon Ford
/
Motor_HelloWorld
Hello World for a simple motor driver class, used to control an H-Bridge with PwmOut and 2 DigitalOuts
Embed:
(wiki syntax)
Show/hide line numbers
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 }
Generated on Tue Jul 12 2022 14:54:08 by 1.7.2