GPS-LEA-5H-0-008
Dependencies: MODSERIAL mbed-src
Fork of GPS_U-blox_NEO-6M_Test_Code by
Revision 2:a889e78df708, committed 2015-11-25
- Comitter:
- lin0904
- Date:
- Wed Nov 25 12:25:17 2015 +0000
- Parent:
- 1:acd907fbcbae
- Commit message:
- Gps_LEA-5H
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r acd907fbcbae -r a889e78df708 main.cpp --- a/main.cpp Fri Aug 22 12:43:55 2014 +0000 +++ b/main.cpp Wed Nov 25 12:25:17 2015 +0000 @@ -3,27 +3,26 @@ * Date: 22-08-14 * Notes: Firmware for GPS U-Blox NEO-6M */ +// http://aprs.gids.nl/nmea/ #include "main.h" - void Init() { gps.baud(9600); - pc.baud(115200); + pc.baud(9600); pc.printf("Init OK\n"); } - - int main() { Init(); char c; - while(true) + while(1) { + wait(.1); if(gps.readable()) { if(gps.getc() == '$'); // wait a $ @@ -33,7 +32,7 @@ c = gps.getc(); if( c == '\r' ) { - //pc.printf("%s\n", cDataBuffer); + pc.printf("%s\n", cDataBuffer); parse(cDataBuffer, i); i = sizeof(cDataBuffer); } @@ -43,11 +42,13 @@ } } } - } + } + else + pc.printf("Fail\n"); + wait(.1); } } - void parse(char *cmd, int n) { @@ -60,22 +61,22 @@ if(strncmp(cmd,"$GPGGA", 6) == 0) { sscanf(cmd, "$GPGGA,%f,%f,%c,%f,%c,%d,%d,%*f,%f", &timefix, &latitude, &ns, &longitude, &ew, &fq, &nst, &altitude); - pc.printf("GPGGA Fix taken at: %f, Latitude: %f %c, Longitude: %f %c, Fix quality: %d, Number of sat: %d, Altitude: %f M\n", timefix, latitude, ns, longitude, ew, fq, nst, altitude); + pc.printf("GPGGA Fix taken at: %f, Latitude: %f %c, Longitude: %f %c, Fix quality: %d, Number of sat: %d, Altitude: %f M\n\r", timefix, latitude, ns, longitude, ew, fq, nst, altitude); } // Satellite status - if(strncmp(cmd,"$GPGSA", 6) == 0) + /*if(strncmp(cmd,"$GPGSA", 6) == 0) { sscanf(cmd, "$GPGSA,%c,%d,%d", &tf, &fix, &nst); pc.printf("GPGSA Type fix: %c, 3D fix: %d, number of sat: %d\r\n", tf, fix, nst); - } + }*/ // Geographic position, Latitude and Longitude - if(strncmp(cmd,"$GPGLL", 6) == 0) + /*if((cmd,"$GPGLL", 6) == 0) { sscanf(cmd, "$GPGLL,%f,%c,%f,%c,%f", &latitude, &ns, &longitude, &ew, &timefix); pc.printf("GPGLL Latitude: %f %c, Longitude: %f %c, Fix taken at: %f\n", latitude, ns, longitude, ew, timefix); - } + }*/ // Geographic position, Latitude and Longitude if(strncmp(cmd,"$GPRMC", 6) == 0) @@ -83,8 +84,4 @@ sscanf(cmd, "$GPRMC,%f,%c,%f,%c,%f,%c,%f,,%d", &timefix, &status, &latitude, &ns, &longitude, &ew, &speed, &date); pc.printf("GPRMC Fix taken at: %f, Status: %c, Latitude: %f %c, Longitude: %f %c, Speed: %f, Date: %d\n", timefix, status, latitude, ns, longitude, ew, speed, date); } -} - - - - +} \ No newline at end of file