It uses 3 serial port one for GPS second for GSM and third for viewing what is happing. GPS longitude, latitude, north-south, east-west is extracted and SMS is send to the number saved in the program about GPS longitude, latitude, north-south, east-west and displayed on LCD.SMS is also retrieved and deleted.
Fork of GPS by
Revision 1:5c5177f8c0d8, committed 2014-10-31
- Comitter:
- josmy
- Date:
- Fri Oct 31 05:15:22 2014 +0000
- Parent:
- 0:15611c7938a3
- Commit message:
- there are no changes in GPS library
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 Tue Jun 08 14:10:27 2010 +0000 +++ b/GPS.cpp Fri Oct 31 05:15:22 2014 +0000 @@ -22,20 +22,21 @@ #include "GPS.h" + GPS::GPS(PinName tx, PinName rx) : _gps(tx, rx) { - _gps.baud(4800); + _gps.baud(9600); longitude = 0.0; latitude = 0.0; } int GPS::sample() { float time; - char ns, ew; + //char ns, ew; int lock; while(1) { getline(); - + // 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) { @@ -48,7 +49,8 @@ float degrees = trunc(latitude / 100.0f); float minutes = latitude - (degrees * 100.0f); latitude = degrees + minutes / 60.0f; - degrees = trunc(longitude / 100.0f * 0.01f); + //degrees = trunc(longitude / 100.0f * 0.01f); + degrees = trunc(longitude / 100.0f ); minutes = longitude - (degrees * 100.0f); longitude = degrees + minutes / 60.0f; return 1;
--- a/GPS.h Tue Jun 08 14:10:27 2010 +0000 +++ b/GPS.h Fri Oct 31 05:15:22 2014 +0000 @@ -45,6 +45,9 @@ /** The latitude (call sample() to set) */ float latitude; + char ns; + char ew; + private: float trunc(float v); void getline();