Ren Buggy
/
HC-SR04_BUGGY
operates the ultrasonics to move the buggy kinda
Diff: main.cpp
- Revision:
- 0:fbceffb594b6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jul 14 12:58:48 2016 +0000 @@ -0,0 +1,39 @@ +#include "mbed.h" +#include "ultrasonic_buggy.h" +//#include "USBSerial.h" + +//USBSerial serial; + + +int main(){ + + float left_distance; + float right_distance; + stop(); + wait(5); + //serial.printf("PROGRAM START\n\r"); + while(1){ + + + //wait(1); + + left_distance = getDistance_l(); + right_distance = getDistance_r(); + + //if((left_distance > 0.3) && (right_distance > 0.3)){ + //serial.printf("left distance = %f right distance = %f\n\r", left_distance, right_distance); + /* if(left_distance > right_distance){ + left(0.1); + } + else if(right_distance > left_distance){ + right(0.1); + } + } + + else{ + right(3); + }*/ + + } +} +