ラジコン用プログラムです。

Dependencies:   mbed ATP3012 a HMC US015_2 getGPS

Files at this revision

API Documentation at this revision

Comitter:
ushiroji
Date:
Wed Dec 15 06:54:35 2021 +0000
Parent:
0:149a860cbcb9
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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 149a860cbcb9 -r 6ff5fbdf32bb Function.h
--- a/Function.h	Fri Dec 10 03:58:41 2021 +0000
+++ b/Function.h	Wed Dec 15 06:54:35 2021 +0000
@@ -25,7 +25,6 @@
 {
         Ultra = 1;  //超音波on
         hs.TrigerOut();
-        wait(1);
         int distance;
         distance = hs.GetDistance(); 
         xbee.printf("distance=%d\r\n", distance);  //距離出力
diff -r 149a860cbcb9 -r 6ff5fbdf32bb main.cpp
--- a/main.cpp	Fri Dec 10 03:58:41 2021 +0000
+++ b/main.cpp	Wed Dec 15 06:54:35 2021 +0000
@@ -3,30 +3,29 @@
 
 int main()
 {
-    xbee.printf("XBee Connected\r\n");
-    xbee.printf("Please enter the following number:");
-    xbee.printf("\'1\':Stop\r\n\
-    \'2\':Go straight\r\n\
-    \'3\':Go back\r\n\
-    \'4\':Turn right\r\n\
-    \'5\':Turn left\r\n");
+    xbee.printf("\r\nXBee Connected");
+    xbee.printf("\r\nPlease enter the following number.\r\n");
+    xbee.printf("*********************\
+             \r\n|\'1\':Stop           |\
+             \r\n|\'2\':Go straight    |\
+             \r\n|\'3\':Go back        |\
+             \r\n|\'4\':Turn right     |\
+             \r\n|\'5\':Turn left      |\
+             \r\n*********************\r\n");
     
     char num = '1';
     float spd = 0;
     
     while(1) {
-        while(xbee.readable()) {
-            xbee.printf("\r\nNumber:");
-            num = getchar();            //stanby
-            xbee.printf("\r\nSpeed:");
-            xbee.scanf("%lf", spd);
-            Move(num, spd);
+        xbee.printf("Number:");
+        xbee.scanf("%c", &num);
+        xbee.printf("Speed:");
+        xbee.scanf("%lf", &spd);
+        xbee.printf("Number:%c, Speed:%f\r\n", num, spd);
+        Move(num, spd);
             
-            if(FrontGet()) {
+        if(FrontGet()) {
             Move('1', 0);
-            }
         }
-        
-        Move('1', 0);
     }
 }
\ No newline at end of file
diff -r 149a860cbcb9 -r 6ff5fbdf32bb mbed.bld
--- a/mbed.bld	Fri Dec 10 03:58:41 2021 +0000
+++ b/mbed.bld	Wed Dec 15 06:54:35 2021 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file
+https://os.mbed.com/users/mbed_official/code/mbed/builds/7c328cabac7e
\ No newline at end of file