Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TAREA_4_GPS_GSM Tarea6_GSM Tarea6_GPSGSM TareaGSM ... more
Fork of GPS7 by
Revision 3:7f621626d7e9, committed 2016-11-18
- Comitter:
- joshema216
- Date:
- Fri Nov 18 21:25:45 2016 +0000
- Parent:
- 2:8d7c7165ffe2
- Commit message:
- Version 2.
Changed in this revision
| GPS.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/GPS.cpp Mon Apr 27 02:08:24 2015 +0000
+++ b/GPS.cpp Fri Nov 18 21:25:45 2016 +0000
@@ -32,10 +32,14 @@
float time;
char ns, ew;
int lock;
-
+ int degla;
+ float minla;
+ int deglo;
+ float minlo;
+
while(1) {
getline();
- //$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
+ //$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
// Check if it is a GPGGA msg (matches both locked and non-locked msg)
if(sscanf(msg, "GPGGA,%f,%f,%c,%f,%c,%d", &time, &latitude, &ns, &longitude, &ew, &lock) >= 1) {
if(!lock) { //si lock es 1 hay lecturas ok
@@ -43,13 +47,19 @@
latitude = 0.0;
return 0;
}
- else {
+ else {
if(ns == 'S') { latitude *= -1.0; }
if(ew == 'W') { longitude *= -1.0; }
latitude = (latitude / 100.0f);
+ degla = (int)latitude;
+ minla = latitude - (degla);
+ latitude = degla + minla/60.0f*100.0f;
//float minutes = latitude - (degrees * 100.0f);
//latitude = degrees + minutes / 60.0f;
longitude = (longitude / 100.0f);
+ deglo = (int)longitude;
+ minlo = longitude - (deglo);
+ longitude = deglo + minlo/60.0f*100.0f;
//minutes = longitude - (degrees * 100.0f);
//longitude = degrees + minutes / 60.0f;
