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 "TextLCD0420.h" 00003 00004 #define ON 1 00005 #define OFF 0 00006 00007 DigitalOut mled0(LED1); 00008 DigitalOut mled1(LED2); 00009 00010 TextLCD lcd(p24, p25, p26, p27, p28, p29, p30,20,4); // rs, rw, e, d0, d1, d2, d3 00011 Serial pc(USBTX, USBRX); // tx, rx 00012 Serial gps(p9,p10); 00013 00014 int main() { 00015 00016 unsigned char c; 00017 int i,rlock; 00018 char gps_data[256],gps2_data[256]; 00019 char ns,ew; 00020 float time,hokui,tokei; 00021 00022 gps.baud(9600); 00023 lcd.cls(); 00024 lcd.locate(0,0); 00025 lcd.printf("*** GPS GT-720F ***"); 00026 00027 while (1) { 00028 i=0; 00029 while(gps.getc()!='$'){ 00030 } 00031 00032 while( (gps_data[i]=gps.getc()) != '\r'){ 00033 i++; 00034 if(i==256){ 00035 lcd.printf("*** Div Error! ***\n"); 00036 i=255; 00037 break; 00038 } 00039 } 00040 gps_data[i]='\0'; 00041 00042 if( sscanf(gps_data, "GPGGA,%f,%f,%c,%f,%c,%d",&time,&hokui,&ns,&tokei,&ew,&rlock) >= 1){ 00043 if(rlock==1){ 00044 lcd.cls(); 00045 lcd.locate(0,0); 00046 lcd.printf("*** GPS GT-720F ***"); 00047 lcd.locate(0,1); 00048 lcd.printf("Status:Lock(%d)",rlock); 00049 // logitude 00050 lcd.locate(0,2); 00051 //lcd.printf"Log:%4.5f",tokei); 00052 lcd.printf("Tokiei:%4.5f",tokei); 00053 //Latitude 00054 lcd.locate(0,3); 00055 // lcd.printf("Lat:%4.5f",hokui); 00056 lcd.printf("Hokui:%4.5f",hokui); 00057 00058 } 00059 else{ 00060 lcd.locate(0,1); 00061 lcd.printf("Status:unLock(%d)",rlock); 00062 lcd.locate(0,2); 00063 for(i=0;i<40;i++){ 00064 lcd.printf("%c",gps_data[i]); 00065 } 00066 } 00067 }//if 00068 }//while 00069 }//main 00070 00071 00072
Generated on Fri Jul 15 2022 00:50:51 by
