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.
main.cpp
00001 #include "mbed.h" 00002 #include "GPS.h" 00003 00004 Serial pc(USBTX, USBRX); 00005 GPS gps(p13, p14); 00006 00007 int main() { 00008 //pc.printf("start main\r\n"); 00009 while(1) { 00010 //wait(0.1); 00011 //pc.printf("\nHello world\n\r"); 00012 //printf ("\n\r the value of GPS sample is : %d\n\r", gps.sample()); 00013 if(gps.sample()) { 00014 //pc.printf("\r\nsampled\r\n"); 00015 pc.printf("Longitude: %f degrees %c\n\rLatitude: %f degrees %c\n\rAltitude: %f meters \n\rUTC time: %f\n\r", gps.longitude, gps.ns, gps.latitude, gps.ew, gps.alt, gps.time); 00016 //pc.printf("good\r\n"); 00017 } else { 00018 pc.printf("Oh Dear! No lock :(\n\r"); 00019 //pc.printf("bad\r\n"); 00020 } 00021 } 00022 } 00023 00024 00025 /* 00026 $GPRMC,000115.039,V,,,,,,,291006,,*2C 00027 $GPGGA,000116.031,,,,,0,00,,,M,0.0,M,,0000*52 00028 $GPGSA,A,1,,,,,,,,,,,,,,,*1E 00029 $GPGSV,3,1,12,20,00,000,,10,00,000,,31,00,000,,27,00,000,*7C 00030 $GPGSV,3,2,12,19,00,000,,07,00,000,,04,00,000,,24,00,000,*76 00031 $GPGSV,3,3,12,16,00,000,,28,00,000,,26,00,000,,29,00,000,*78 00032 $GPRMC,000116.031,V,,,,,,,291006,,*27 00033 $GPGGA,000117.035,,,,,0,00,,,M,0.0,M,,0000*57 00034 $GPGSA,A,1,,,,,,,,,,,,,,,*1E 00035 $GPRMC,000117.035,V,,,,,,,291006,,*22 00036 $GPGGA,000118.039,,,,,0,00,,,M,0.0,M,,0000*54 00037 $GPGSA,A,1,,,,,,,,,,,,,,,*1E 00038 $GPRMC,000118.039,V,,,,,,,291006,,*21 00039 $GPGGA,000119.035,,,,,0,00,,,M,0.0,M,,0000*59 00040 $GPGSA,A,1,,,,,,,,,,,,,,,*1E 00041 $GPRMC,000119.035,V,,,,,,,291006,,*2C 00042 $GPGGA,000120.037,,,,,0,00,,,M,0.0,M,,0000*51 00043 $GPGSA,A,1,,,,,,,,,,,,,,,*1E 00044 $GPRMC,000120.037,V,,,,,,,291006,,*24 00045 */
Generated on Thu Jul 21 2022 01:54:50 by
1.7.2