Example

Dependencies:   mbed

Fork of PololuQik2 by stephen smitherman

main.cpp

Committer:
johnson6987
Date:
2014-09-15
Revision:
1:1ac7b13ff4c3

File content as of revision 1:1ac7b13ff4c3:

#include "mbed.h"
#include "PololuQik2.h"
#include "CRC7.h"


void Error()
{
    printf("ERROR");
}

//(PinName TxPin, PinName RxPin, PinName RSTPin, PinName errPin, void(*errorFunction)(void), bool enCRC)
PololuQik2 driver1(p9,p10,p11,p12,&Error,0);



int main()
{

    driver1.begin();


    while (1) {
        for(int x=0; x<=127; x++) {
            driver1.setMotor0Speed(x);
            driver1.setMotor1Speed(x);
            wait(.05);
        }
        for(int x=127; x>=-127; x--) {
            driver1.setMotor0Speed(x);
            driver1.setMotor1Speed(x);
            wait(.05);
        }
        for(int x=-127; x<0; x++) {
            driver1.setMotor0Speed(x);
            driver1.setMotor1Speed(x);
            wait(.05);
        }
    }
}