Edward Ho Wee Jin
/
GPS
GPS with altitudes
Fork of GPS by
Revision 3:702fee8fe3a0, committed 2016-03-18
- Comitter:
- hokyung
- Date:
- Fri Mar 18 09:45:06 2016 +0000
- Parent:
- 2:addb687a4e73
- Commit message:
- For Imran
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r addb687a4e73 -r 702fee8fe3a0 main.cpp --- a/main.cpp Fri Mar 11 10:25:05 2016 +0000 +++ b/main.cpp Fri Mar 18 09:45:06 2016 +0000 @@ -15,10 +15,11 @@ float longitude; /** The latitude (call sample() to set) */ - float latitude,time2; + float latitude,time2,altitude, precision; char ns, ew; - int lock; + int lock, satellites; + int main() { uart1.baud(9600); //vitesse de transmission de informations printf("hello\n"); //test @@ -27,12 +28,13 @@ { getline(uart1,msg,999); - if ( sscanf(msg, "$GPGGA,%f,%f,%c,%f,%c,%d", &time2, &latitude, &ns, &longitude, &ew, &lock )>=1) + if ( sscanf(msg, "$GPGGA,%f,%f,%c,%f,%c,%d,%d,%f,%f", &time2, &latitude, &ns, &longitude, &ew, &lock , &satellites, &precision, &altitude)>=1) { if(!lock) { longitude = 0.0; latitude = 0.0; - pc.printf("long= %f %c latitude= %f %c\n",&longitude, &ew, &latitude, &ns); + altitude = 0.0; + pc.printf("long= %f %c latitude= %f %c altitude= %f\n",longitude, ew, latitude, ns, altitude); } else { if(ns == 'S') { latitude *= -1.0; } if(ew == 'W') { longitude *= -1.0; } @@ -43,7 +45,7 @@ minutes = longitude - (degrees * 100.0f); longitude = degrees + minutes / 60.0f; pc.printf("time = %f \n", time2); - pc.printf("long= %f %c latitude= %f %c\n",longitude, ew, latitude, ns); + pc.printf("long= %f %c latitude= %f %c altitude= %f(meters) number of satellites= %d precision= %f\n",longitude, ew, latitude, ns, altitude, satellites, precision); }//end else }//end if }//end if