Tests motors - increments one, decrements the other
Dependencies: mbed
Fork of FRDM-K64_PWM by
main.cpp
- Committer:
- joshwilkins2013
- Date:
- 2015-03-31
- Revision:
- 3:8065a36c54ad
- Parent:
- 2:d861baf2b13b
File content as of revision 3:8065a36c54ad:
#include "mbed.h" //PWM output channel PwmOut PWM1(PTD0); PwmOut PWM2(PTC4); DigitalOut PinI1(PTA0); //pin 8 DigitalOut PinI2(PTD2); // pin 11 DigitalOut PinI3(PTD3); // pin 12 DigitalOut PinI4(PTD1); // pin 13 int main() { 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(y); x++; y--; wait(.25); if(x==255) x=1; if(y==0) y=255; } }