GPS Data

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Rbinas
Date:
Wed May 02 03:07:56 2018 +0000
Commit message:
Display GPS Data from GPS receiver

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed May 02 03:07:56 2018 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+//Display GPS data from GPS. I'm using a holybro GPS Receiver
+// Reference  https://mikan.github.io/2017/11/07/using-pa6c-with-mbed/
+
+Serial gps(p9, p10);       // TX, RX
+Serial pc(USBTX, USBRX);    // TX, RX
+DigitalOut led1(LED1);
+
+int main() {
+    pc.baud(9600);
+    char gpsout[1024];
+    while (1) {
+        gpsout[0] = '\0';
+        while (1) {
+            char c = gps.getc();
+            char s[2];
+            s[0] = c;
+            s[1] = '\0';
+            strcat(gpsout, s);
+            if (c == '\n') {
+                break;
+            }
+        }
+        pc.printf(gpsout);
+        led1 = !led1;
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed May 02 03:07:56 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/5aab5a7997ee
\ No newline at end of file