Parallax Activity Bot code
Dependencies: ContinuousServo Tach mbed
main.cpp
- Committer:
- lddevrie
- Date:
- 2018-03-02
- Revision:
- 2:f72b9dd19159
- Parent:
- 0:ac6a1723d393
- Child:
- 3:e33676098294
File content as of revision 2:f72b9dd19159:
#include "mbed.h" #include "ContinuousServo.h" #include "Tach.h" // Test change Serial pc(USBTX,USBRX); //servos ContinuousServo left(p23); ContinuousServo right(p26); //encoders Tach tLeft(p17,64); Tach tRight(p13,64); int main() { //wait for MATLAB command left.speed(0.0); right.speed(0.0); //while(1); pc.getc(); //spin servos from -1 to 1 and print speed for(float i=-1.0;i<=1.0;i+=0.01){ left.speed(-1.0*i); right.speed(i); wait_ms(100); pc.printf("%f,%f\n", tLeft.getSpeed(),tRight.getSpeed()); } left.stop(); right.stop(); }