Horng-Yih Lai
/
mbed_Motor_Control
mbed DC Motor Control
Diff: main.cpp
- Revision:
- 0:9be8dbe348a2
diff -r 000000000000 -r 9be8dbe348a2 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Feb 09 11:26:48 2015 +0000 @@ -0,0 +1,29 @@ +#include "mbed.h" + +DigitalOut ledForPower1(LED1); +DigitalOut ledForPower2(LED2); +DigitalOut ledForPower3(LED3); +DigitalOut ledForPower4(LED4); +PwmOut motor(p21); + +int main() { + + motor=0; + wait(2); + + motor=0.4; + ledForPower1=1; + wait(2); + + motor=0.6; + ledForPower2=1; + wait(2); + + motor=0.8; + ledForPower3=1; + wait(2); + + motor=1; + ledForPower4=1; + +}