回避行動用のプログラムです。 (モータードライバー+超音波センサー)

Dependencies:   ATP3012 mbed a HMC US015_2 getGPS

Files at this revision

API Documentation at this revision

Comitter:
ushiroji
Date:
Fri Dec 03 08:24:39 2021 +0000
Parent:
0:99f4fe3e21c6
Commit message:
first version

Changed in this revision

Function.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 99f4fe3e21c6 -r 1c4c7cd015e8 Function.h
--- a/Function.h	Wed Dec 01 08:14:01 2021 +0000
+++ b/Function.h	Fri Dec 03 08:24:39 2021 +0000
@@ -30,7 +30,7 @@
         xbee.printf("distance=%d\r\n", distance);  //距離出力
         Ultra=0;//超音波off
         
-        if(distance < 500) {
+        if(distance < 1500) {
             return 1;
         }
         else {
diff -r 99f4fe3e21c6 -r 1c4c7cd015e8 main.cpp
--- a/main.cpp	Wed Dec 01 08:14:01 2021 +0000
+++ b/main.cpp	Fri Dec 03 08:24:39 2021 +0000
@@ -6,14 +6,10 @@
     while(1) {
     Move('2', 0.3);
         while(FrontGet()) {
-        xbee.printf("front get\n\r");
         Move('1', 0);      //停止
-        xbee.printf("mortor mode:1 speed:0\n\r");
-        Move('4', 0.3);    //時計回り回転
-        xbee.printf("mortor mode:4 speed:0.5\n\r");
-        wait(1);
+        Move('4', 0.2);    //時計回り回転
+        wait(0.5);
         Move('1', 0);      //回転停止
-        xbee.printf("mortor mode:1 speed:0\n\r");
         }
     }
 }