Tests motors - increments one, decrements the other
Dependencies: mbed
Fork of FRDM-K64_PWM by
Diff: main.cpp
- Revision:
- 1:fd419b982c73
- Parent:
- 0:24a5f9b6fd64
- Child:
- 2:d861baf2b13b
diff -r 24a5f9b6fd64 -r fd419b982c73 main.cpp --- a/main.cpp Wed Jul 09 19:31:42 2014 +0000 +++ b/main.cpp Mon Mar 23 15:45:46 2015 +0000 @@ -1,20 +1,32 @@ #include "mbed.h" //PWM output channel -PwmOut PWM1(A5); +PwmOut PWM1(PTD0); +PwmOut PWM2(PTC4); + +DigitalOut PinI1(PTA0); //pin 8 +DigitalOut PinI2(PTD2); // pin 11 + -int main() +DigitalOut PinI3(PTD3); // pin 12 +DigitalOut PinI4(PTD1); // pin 13 + +int main() { - PWM1.period_ms(500); + PinI1 = PinI3 = 0; + PinI2 = PinI4 = 1; + PWM1.period_ms(255); + PWM2.period_ms(255); int x; x=1; while(1) { PWM1.pulsewidth_ms(x); + PWM2.pulsewidth_ms(x); x=x+1; - wait(.1); - if(x==500) + wait(1); + if(x==255) { x=1; }