Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "ultrasonic_buggy.h" 00003 //#include "USBSerial.h" 00004 00005 //USBSerial serial; 00006 00007 00008 int main(){ 00009 00010 float left_distance; 00011 float right_distance; 00012 stop(); 00013 wait(5); 00014 //serial.printf("PROGRAM START\n\r"); 00015 while(1){ 00016 00017 00018 //wait(1); 00019 00020 left_distance = getDistance_l(); 00021 right_distance = getDistance_r(); 00022 00023 //if((left_distance > 0.3) && (right_distance > 0.3)){ 00024 //serial.printf("left distance = %f right distance = %f\n\r", left_distance, right_distance); 00025 /* if(left_distance > right_distance){ 00026 left(0.1); 00027 } 00028 else if(right_distance > left_distance){ 00029 right(0.1); 00030 } 00031 } 00032 00033 else{ 00034 right(3); 00035 }*/ 00036 00037 } 00038 } 00039
Generated on Sat Jul 16 2022 22:15:49 by
