You can get GPS data.

Dependencies:   mbed

GPS GH-80をひとまず読むためのプログラム GH-81でもいけるかも

3ピン tx

4 rx

8 GND

9 Vcc

7 VBCK

Files at this revision

API Documentation at this revision

Comitter:
yosatak
Date:
Thu Oct 03 04:34:53 2013 +0000
Parent:
0:5c614665fc7e
Commit message:
new GPS;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 5c614665fc7e -r 9c9d8b7e23e8 main.cpp
--- a/main.cpp	Wed Oct 02 13:19:14 2013 +0000
+++ b/main.cpp	Thu Oct 03 04:34:53 2013 +0000
@@ -4,10 +4,54 @@
 Serial pc(USBTX, USBRX);
 
 int gps_data[46];
+int gps[23];
 
+int gpsget(int m)
+{
+    for(int i=0; i<46; i++){
+        gps_data[i] = GPS.getc(); //gpsdata get
+    }
+    
+    for(int j=0; j<46; j++){//find header
+    
+        if(gps_data[j]==0xe0){//found header
+        
+            for(int k=0; k<23;k++){
+                gps[k] = gps_data[j+k];//int gps[byte-1]is data
+            }
+        break;
+        }
+    }
+    return gps[m];
+}
+    
+int ido;
+int idoget(void) 
+{
+    for(int n=3; n<7; n++){
+        ido = 0;
+        ido << 7;
+        ido = ido | gpsget(n);
+    }
+    ido =ido / 6;
+    return ido;
+}
+int keido;
+int keidoget(void){
+    for(int n=7; n<11; n++){
+        keido = 0;
+        keido << 7;
+        keido = keido | gpsget(n);
+    }
+    keido = keido / 6;
+    pc.printf("%d",keido);
+    return keido;
+}    
 
 int main(void)
 {
+    pc.printf("%d/%d",idoget(),keidoget());
+/*
     for(int i=0; i<46; i++){
         gps_data[i] = GPS.getc(); //gpsdata get
     }
@@ -41,4 +85,5 @@
     }
     keido = keido / 6;
     pc.printf("%d",keido);
+    */
 }
\ No newline at end of file