![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
First run
Dependencies: ContinuousServo Tach mbed
Diff: main.cpp
- Revision:
- 0:a0013f51f232
- Child:
- 1:be893bda5f00
diff -r 000000000000 -r a0013f51f232 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Apr 23 15:15:49 2018 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" +#include "ContinuousServo.h" +#include "Tach.h" + +Tach tLeft(p17,64); +Tach tRight(p13,64); + +ContinuousServo left(p23); +ContinuousServo right(p26); +AnalogIn sonar(p19); +float distance; + +int main() { + while(1) { + distance = //inches; + distance = //conversion to analog value; + if (sonar > distance){ + left.speed(); + right.speed(); + } + else { + break; + } + } +}