motor

Dependencies:   VNH5019 mbed

main.cpp

Committer:
s1210160
Date:
2016-06-15
Revision:
0:974de11b1491
Child:
1:6ad72ace0fec

File content as of revision 0:974de11b1491:

#include "mbed.h"
#include "VNH5019.h"

VNH5019 motorShield(p23,p22,p25,p21,p24,p26);
Serial pc(USBTX, USBRX);
Serial xbee(p13, p14);

int main()
{

    char c;

    while(true) {
        c = xbee.getc();

        if(c == 'f') {
            motorShield.changeSpeed(1, 255, 1, 255);
        }
        
        if(c == 'b'){
            motorShield.changeSpeed(2, 255, 2, 255);
        }
        
        if(c == 'l'){
            motorShield.changeSpeed(0, 255, 1, 255);
        }
        
        if(c == 'r') {
            motorShield.changeSpeed(1, 255, 0, 255);
        }

        if(c == 's') {
            motorShield.changeSpeed(0, 255, 0, 255);
        }
    }
    return 0;
}