C027_C20_U20_G35 revB with SARA-G350 GPS library.
Dependencies: GPS_C027_C20_U20_G35_revB_SARA_G350 mbed
Fork of C027_HelloWorld by
Diff: main.cpp
- Revision:
- 6:7f0ed1d69dc1
- Parent:
- 5:41b123533b79
--- a/main.cpp Fri Dec 06 09:58:29 2013 +0000 +++ b/main.cpp Sat Feb 22 13:28:33 2014 +0000 @@ -1,17 +1,29 @@ #include "mbed.h" -#include "C027.h" - -#ifdef C027_REVA - // on rev A we reasign the signal to A0 - #undef LED - #define LED A0 -#endif - -DigitalOut myled(LED); +#include "GPS.h" + +Serial pc(USBTX, USBRX); +GPS gps(P0_10, P0_11, 9600); int main() { - while(1) { - myled = !myled; - wait(0.2); - } + pc.baud(9600); + + while (1) { + wait(3); + pc.printf("hello, a test \n"); + gps.sample(); + pc.printf("GPS Sats number is %d \n", gps.sats); + + if (gps.ns == 'S') + pc.printf("GPS Latitude = %.4f South; ", gps.latitude * -1.0); + else if (gps.ns == 'N') + pc.printf("GPS Latitude = %.4f North; ", gps.latitude); + if (gps.ew == 'W') + pc.printf("Longitude = %.4f West; ", gps.longitude * - 1.0); + else if (gps.ew == 'E') + pc.printf("Longitude = %.4f East; ", gps.longitude); + pc.printf("Alt = %.4f ", gps.alt); + + } + + }