Tests motors - increments one, decrements the other
Dependencies: mbed
Fork of FRDM-K64_PWM by
Diff: main.cpp
- Revision:
- 3:8065a36c54ad
- Parent:
- 2:d861baf2b13b
--- a/main.cpp Mon Mar 23 15:51:27 2015 +0000 +++ b/main.cpp Tue Mar 31 22:37:36 2015 +0000 @@ -12,18 +12,22 @@ int main() { - PinI1 = PinI3 = 0; - PinI2 = PinI4 = 1; + PinI1 = PinI3 = 1; + PinI2 = PinI4 = 0; PWM1.period_ms(255); PWM2.period_ms(255); int x; x=1; + int y; + y=255; while(1){ PWM1.pulsewidth_ms(x); - PWM2.pulsewidth_ms(x); - x=x+1; - wait(1); + PWM2.pulsewidth_ms(y); + x++; + y--; + wait(.25); if(x==255) x=1; + if(y==0) y=255; } } \ No newline at end of file