Updated version with new commands and sleep mode
Fork of GPS by
Revision 4:9ac674d05370, committed 2014-01-19
- Comitter:
- SamClarke
- Date:
- Sun Jan 19 07:44:51 2014 +0000
- Parent:
- 3:5cb504ce2793
- Child:
- 5:96d5736d9613
- Commit message:
- Further breakdown of date into usable variables. This has made is suitable for my satellite tracking project.
Changed in this revision
GPS.cpp | Show annotated file Show diff for this revision Revisions of this file |
GPS.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/GPS.cpp Sun Oct 21 09:28:41 2012 +0000 +++ b/GPS.cpp Sun Jan 19 07:44:51 2014 +0000 @@ -1,5 +1,4 @@ #include "GPS.h" - GPS::GPS(PinName tx, PinName rx) : _UltimateGps(tx, rx) { _UltimateGps.baud(9600); @@ -7,14 +6,14 @@ int GPS::parseData() { - while(1) { getData(); if(sscanf(NEMA, "GPGGA, %*f, %*f, %*c, %*f, %*c, %d, %d, %*f, %f", &fixtype, &satellites, &altitude) >=1); - if(sscanf(NEMA, "GPRMC, %2d%2d%f, %c, %f, %c, %f, %c, %f, %f, %d", &hours, &minutes, &seconds, &validity, &latitude, &ns, &longitude, &ew, &speed, &heading, &date) >=1) { + if(sscanf(NEMA, "GPRMC, %2d%2d%f, %c, %f, %c, %f, %c, %f, %f, %2d%2d%2d", &hours, &minutes, &seconds, &validity, &latitude, &ns, &longitude, &ew, &speed, &heading, &day, &month, &year) >=1) { if(fixtype == 0) { return 0; } + year += 2000; if(ns =='S') { latitude *= -1.0; }
--- a/GPS.h Sun Oct 21 09:28:41 2012 +0000 +++ b/GPS.h Sun Jan 19 07:44:51 2014 +0000 @@ -37,7 +37,10 @@ float longitude; // float speed; // speed in knots float heading; // heading in degrees derived from previous & current location - int date; // + string date; // + int day; + int month; + int year; int fixtype; // 0 = no fix; 1 = fix; 2=differential fix int satellites; // number of satellites used float altitude; //