Tests motors - increments one, decrements the other

Dependencies:   mbed

Fork of FRDM-K64_PWM by Augusto Panecatl

main.cpp

Committer:
Reimerguns
Date:
2015-03-23
Revision:
1:fd419b982c73
Parent:
0:24a5f9b6fd64
Child:
2:d861baf2b13b

File content as of revision 1:fd419b982c73:

#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 = 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==255)
        {
            x=1;
        }
    }
}