mbed用GPSモジュール利用プログラム for IZU 割り込みを利用し、自動的に内部変数へ座標などのデータが更新されるようになっている。そのため、好きなタイミングで専用関数により値を取得できる。

Dependencies:   GPS_interrupt mbed

Revision:
1:1d1b6b0396d1
Child:
2:c05887794ff5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Hybrid_interruptGPS.cpp	Mon Jan 02 00:43:18 2017 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+#include "GPS_interrupt.h"
+Serial pc(USBTX, USBRX);
+RawSerial mygps(p9, p10);
+
+GPS_interrupt gps(&mygps, 9600);
+
+int main() {
+    
+    pc.baud(115200);
+    mygps.baud(9600);
+    
+    pc.printf("%d Hz\r\n", SystemCoreClock );
+    
+    wait(3.0);
+    while(1){
+        //if(gps.gps_readable){
+            double xy[2] = {0};
+            float utc[6] = {0};
+            gps.getPosition(xy);
+            gps.getUTC(utc);
+            pc.printf("%d 年 %d 月 %d 日 %d 時 %d 分 %02.2f 秒 ",(int)utc[0],(int)utc[1], (int)utc[2], (int)utc[3], (int)utc[4] ,utc[5]); 
+            pc.printf("lon %f\tlat %f\r\n",xy[0], xy[1]);
+            wait(0.10);
+           // gps.gps_readable = false;
+        //}
+        
+    }
+}