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.
Dependencies: mbed URF MD_MDDS30_oit_ ros_lib_melodic
Diff: URF_check.txt
- Revision:
- 1:f6a9a3a7455d
- Parent:
- 0:450a7208c682
- Child:
- 2:87caac24d995
diff -r 450a7208c682 -r f6a9a3a7455d URF_check.txt
--- a/URF_check.txt Tue May 03 08:02:58 2022 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-#include "mbed.h"
-#include "URF.h"
-
-Serial pc(USBTX, USBRX, 115200);
-
-URF usdRight(D6);
-URF usdLeft(D8);
-
-Ticker update;
-
-DigitalOut led(LED1);
-DigitalOut led2(PC_4);
-
-DigitalIn btn(USER_BUTTON);
-
-void inter(void)
-{
- usdRight.send();
- usdLeft.send();
-}
-
-void URF(int dataRight, int dataLeft){
- if(dataRight>100 && dataRight<=230){
- pc.printf("right slow\n");
- //Yonrin(-0.3f, 0);
- if(dataLeft>100 && dataLeft<=230){
- pc.printf("left slow\n");
- //Yonrin(0.3f, 0);
- }
- else if(dataLeft<=100){
- pc.printf("left stop\n");
- //Yonrin(0);
- }
- }
- else if(dataRight<=100){
- pc.printf("right stop\n");
- //Yonrin(0);
- if(dataLeft>100 && dataLeft<=230){
- pc.printf("left slow\n");
- //Yonrin(0.3f, 0);
- }
- else if(dataLeft<=100){
- pc.printf("left stop\n");
- //Yonrin(0);
- }
- }
- else if(dataLeft>100 && dataLeft<=230){
- pc.printf("left slow\n");
- //Yonrin(0.3f, 0);
- if(dataRight>100 && dataRight<=230){
- pc.printf("right slow\n");
- //Yonrin(-0.3f, 0);
- }
- else if(dataRight<=100){
- pc.printf("right stop\n");
- //Yonrin(0);
- }
- }
- else if(dataLeft<=100){
- pc.printf("left stop\n");
- //Yonrin(0);
- if(dataRight>100 && dataRight<=230){
- pc.printf("right slow\n");
- //Yonrin(-0.3f, 0);
- }
- else if(dataRight<=100){
- pc.printf("right stop\n");
- //Yonrin(0);
- }
- }
-}
-
-int main(){
- pc.printf("check1\n");
-
- update.attach(&inter, 0.06);
-
- while(1){
- int dataRight = usdRight.read(mm);
- int dataLeft = usdLeft.read(mm);
- //pc.printf("right: %d, left: %d\n", dataRight, dataLeft);
-
- if(dataRight<=230 || dataLeft<=230){
- URF(dataRight,dataLeft);
- }
- }
-}
\ No newline at end of file