Open Loop drive forward

Dependencies:   mbed Tach ContinuousServo

main.cpp

Committer:
m211482
Date:
2019-04-16
Revision:
0:072052527879
Child:
1:da5831bec373

File content as of revision 0:072052527879:

#include "mbed.h"
#include "ContinuousServo.h"
#include "Tach.h"

//servos
ContinuousServo left(p23);
ContinuousServo right(p26);
//ecnoders
Tach tLeft(p17,64);
Tach tRight(p13,64);
float wL;
float wR;
int main() {
    while(1) {
        left.speed(0.49);
        wL=tLeft.getSpeed();
        right.speed(-0.5); //the servo is inverted so much be negative
        wR=tRight.getSpeed();
        printf("Both moving, l=%f, r=%f\n\r",wL,wR);
        wait(0.5);
        left.stop();
        right.stop();
        
    }
}