Open Loop drive forward
Dependencies: mbed Tach ContinuousServo
Diff: main.cpp
- Revision:
- 0:072052527879
- Child:
- 1:da5831bec373
diff -r 000000000000 -r 072052527879 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Apr 16 14:54:18 2019 +0000 @@ -0,0 +1,25 @@ +#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(); + + } +}