Tachinit
Dependencies: mbed Tach ContinuousServo
Diff: main.cpp
- Revision:
- 0:9acdbbfa4eb2
- Child:
- 1:66d0178e8f40
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Apr 17 14:45:09 2019 +0000 @@ -0,0 +1,38 @@ +//Satre Gagnon, Ewing, Batten +//Tach Initial + +#include "mbed.h" +#include "ContinuousServo.h" +#include "Tach.h" + + +Serial pc(USBTX,USBRX); //Establish serial connection + +//speed +float wL, wR; + +ContinuousServo left(p23); +ContinuousServo right(p26); + +//encoders +Tach tleft(p17,64); +Tach tright(p13,64); + +int main() +{ + + pc.baud(9600); //set baud rate + + while(1) { + + left.speed(0.5); + right.speed(-0.5); //right negative to go forward + + wL = tleft.getSpeed(); //speed of left wheel (rev/sec) + wR = tright.getSpeed(); //speed of right wheel (rev/sec) + + pc.printf("%f, %f\n", wL, wR); + wait(1); + +} //while +} //main \ No newline at end of file