ループのテスト

Dependencies:   ATP3012 mbed TB6612FNG HMC6352 US015 getGPS

Revision:
18:057b39ca7bd1
Parent:
17:1b6a84ab4433
Child:
19:fb9b9795ad9e
--- a/main.cpp	Thu Oct 28 09:36:33 2021 +0000
+++ b/main.cpp	Thu Oct 28 09:57:35 2021 +0000
@@ -17,8 +17,8 @@
     int last_num;         // CPリストの最後の要素のインデックス*/
     double GPS_x, GPS_y;  // 現在地の座標
     double direction;     // 次CPへの向き
-    double CPs_x[3]={34.545658, 34.545837, 34.546052};  // = [];  //CPリスト(x座標)
-    double CPs_y[3]={135.503469, 135.503676, 135.503503};  // = [];  // CPリスト(y座標)
+    double CPs_x[3]={1, 2, 3};  // = [];  //CPリスト(x座標)
+    double CPs_y[3]={1, 2, 3};  // = [];  // CPリスト(y座標)
     double next_CP_x, next_CP_y;
     
     // 落下検知
@@ -46,7 +46,11 @@
         next_CP_y = CPs_y[i];
         
         pc.printf("i=%d\r\n", i);
-        catchGPS();
+        //catchGPS();
+        pc.printf("\n\rlatitude=");
+        pc.scanf("%lf",&gps.latitude);
+        pc.printf("\n\rlongititude=");
+        pc.scanf("%lf",&gps.longitude);
         pc.printf("%lf %lf\r\n", gps.latitude, gps.longitude);
             
             while (1) {
@@ -76,7 +80,11 @@
                 else {
                     Move('2', 0.5);
                 }
-                catchGPS();
+                ///catchGPS();
+                pc.printf("\n\rlatitude=");
+                pc.scanf("%lf",&gps.latitude);
+                pc.printf("\n\rlongititude=");
+                pc.scanf("%lf",&gps.longitude);
                 pc.printf("%lf %lf\r\n", gps.latitude, gps.longitude);
                 if ((next_CP_x - GPS_x)*(next_CP_x - GPS_x) + (next_CP_y = GPS_y)*(next_CP_y = GPS_y) < 0.01) { // CP到着判定 //試験で調整
                     pc.printf("now leach cp[%d]=x_%f,y_%f",i,next_CP_x ,next_CP_y);