cansat_B 2019 / Mbed 2 deprecated GPSと走行の統合 1

Dependencies:   mbed

Revision:
6:892eb32f6dc3
Parent:
5:f3b266c917a6
--- a/gps.cpp	Wed Nov 13 12:14:34 2019 +0000
+++ b/gps.cpp	Thu Dec 05 00:17:03 2019 +0000
@@ -1,32 +1,49 @@
 #include "mbed.h"
 #include "getGPS.h"
 #include "math.h"
+#include "TB6612.h"
 
 Serial pc(USBTX,USBRX);
 GPS gps (p28,p27);
 Serial xbee(p13,p14);
+TB6612 left(p25,p17,p16);
+TB6612 right(p26,p19,p18);
 
 
 int main() {
      double a;
      double b;
      double distance;
-    
-    pc.printf("GPS Start\n");
-    xbee.printf("s\n");
+     int i = 0;
+     
+     pc.printf("GPS Start\n");
+     xbee.printf("s\n");
      while(1) {
          if(gps.getgps()){
+           
+          pc.printf("(%lf,%lf)\r\n",gps.latitude,gps.longitude);//緯度と経度を表示   
+          i ++;
+          if(i<29){
+           }else if(i == 30){
            a = gps.latitude;
            b = gps.longitude;
            
-          pc.printf("(%lf,%lf)\r\n",gps.latitude,gps.longitude);//緯度と経度を表示   
+           }else{
            break;
-           
+           }
          }else{
           pc.printf("NO DATA\r\n");//データ取得失敗
           wait(1);
             }
        }
+       
+        left = 100; //左モーター100%
+        right = 100;//右モーター100%
+        wait(30);
+        left = 0; //左モーター10%
+        right = 0;//右モーター10%(左折)
+        wait(15);
+        
       while(1){
          if(gps.getgps()) {
            
@@ -70,6 +87,14 @@
      }
      
      
+ 
+
+ 
+
+
+
+
+