change2shinsu

Dependencies:   mbed mbedTimer SDFileSystem MU2 GPS

Revision:
4:0d087e3f731d
Parent:
3:4f1bac105598
Child:
5:6d0de80387cf
Child:
6:b7bf39bc3487
--- a/main.cpp	Mon Aug 05 07:44:41 2019 +0000
+++ b/main.cpp	Tue Aug 06 08:54:58 2019 +0000
@@ -4,7 +4,7 @@
 #include "inletclose.h"
 //#include "GPS.h"
 
-MU2 MuPort(p27,p28);
+MU2 MuPort(p28,p27);
 SDFileSystem sd(p11, p12, p13, p14, "sd");
 //GPS gps(p13,p14);
 Serial gps(p9,p10); //tx, rx
@@ -16,6 +16,7 @@
 DigitalOut FIRE(p24);    //溶断
 
 DigitalOut myled(LED1);
+DigitalOut myled2(LED2);
 DigitalOut myled3(LED3);
 DigitalOut myled4(LED4);
 
@@ -52,12 +53,13 @@
     char getGPS[128];
     int i=0;
     int timer=0;
-    int count=0;
 
     //fprintf(fp1, "GPS start!\r\n");
 
     while(1) 
     {
+        myled3=1;
+        myled2=0;
         if(gps.readable()) 
         {
             recvGPS=gps.getc();
@@ -68,8 +70,7 @@
 
                 if((getGPS[5]=='G')&&(getGPS[6]=='A')) 
                 {
-                    if(count==10)
-                    {
+                    
                         MuPort.send(getGPS);
                     
                     /*if(fp == NULL) {
@@ -79,20 +80,17 @@
                     fprintf(fp2, "%s\n",getGPS);
                     //fclose(fp);
                     
-                    count=0;
-                    }
                     wait(0.1);
+                    timer++;
                 }
 
                 i=0;
             }
             i++;
-            timer++;
-            if(timer>150)//落下開始してからTBD秒後whileを抜ける.
+            if(timer>10)//落下開始してからTBD秒後whileを抜ける.
             {
                 break;
             }
-            count++;
         }
 
         // wait(1);
@@ -101,6 +99,8 @@
     
     while(1) 
     {
+        myled3=0;
+        myled2=1;
         if(gps.readable()) 
         {
             recvGPS=gps.getc();
@@ -111,9 +111,7 @@
 
                 if((getGPS[5]=='G')&&(getGPS[6]=='A')) 
                 {
-                    if(count==10)
-                    { 
-                        MuPort.send(getGPS);
+                    MuPort.send(getGPS);
                     
                     /*if(fp == NULL) {
                         error("Could not open file for write\n");
@@ -121,8 +119,6 @@
 
                     fprintf(fp2, "%s\n",getGPS);
                     //fclose(fp);
-                    count=0;
-                    }
                     wait(0.1);
                 }
 
@@ -130,7 +126,6 @@
             }
             i++;
             inlet.Close(0.9);
-            count++;
         }
 
         // wait(1);