michael mosbach
/
Motor_HelloWorld
A litttle pwm and motorprogram to show how libaryswork
main.cpp
- Committer:
- moba
- Date:
- 2010-11-24
- Revision:
- 0:d2bac1ae4460
File content as of revision 0:d2bac1ae4460:
// Sweep the motor speed from full-speed reverse (-1.0) to full speed forwards (1.0) #include "mbed.h" #include "Motor.h" Motor m1(p23, p6, p5); // pwm, fwd, rev PwmOut led1(LED1); PwmOut led2(LED2); int main() { Serial pc(USBTX, USBRX); while (1) { led2 = 1-led1; led1 = led1 + 0.01; wait(0.02); if (led1 == 1.0) { led1 = 0; } if (led2 == 0) { led2 = 1,0; } { //r (float s= -1.0; s < 1.0 ; s += 0.01) { m1.speed(s); float s=0.45 } pc.printf("Hallo"); } }