GPS library
Diff: GPS.cpp
- Revision:
- 5:42f6779a9584
- Parent:
- 4:3aa177df0bcb
- Child:
- 6:0a167594f765
diff -r 3aa177df0bcb -r 42f6779a9584 GPS.cpp --- a/GPS.cpp Wed Mar 16 04:37:56 2016 +0000 +++ b/GPS.cpp Wed Mar 16 05:09:48 2016 +0000 @@ -28,7 +28,11 @@ _gps.baud(9600); longitude = 0.0; - latitude = 0.0; + latitude = 0.0; + ns = 'N'; + ew = 'E'; + alt = 0.0; + } int GPS::sample() { @@ -48,7 +52,10 @@ if(sscanf(msg, "GPGGA,%f,%f,%c,%f,%c,%d,%d,%f,%f,%c,%f,%c", &time, &latitude, &ns, &longitude, &ew, &lock, &num_sat, &hori_dilute, &alt, &hu, &geoid, &gu/*, &age_diff, &diff_ID*/) >= 1) { if(!lock) { longitude = 0.0; - latitude = 0.0; + latitude = 0.0; + ns = 'N'; + ew = 'E'; + alt = 0.0; return 0; } else { //if(ns == 'S') { latitude *= -1.0; } @@ -60,6 +67,12 @@ // minutes = longitude - (degrees * 100.0f); // longitude = degrees + minutes / 60.0f; // pc1.printf(msg); + pc1.printf("\n\rlongitude is %f\n\r", longitude); + pc1.printf("\n\rtime is %f\n\r", time); + pc1.printf("ns is %c\n\r", ns); + pc1.printf("ew is %c\n\r", ew); + pc1.printf("alt is %f\n\r", alt); + latitude /= 100; longitude /= 100;