GPSlibrary
GPS.cpp
- Committer:
- Nerosho
- Date:
- 2019-09-02
- Revision:
- 6:5694d998a23f
- Parent:
- 5:c9ab983a9b3b
File content as of revision 6:5694d998a23f:
/* *2019.0826 * */ #include "mbed.h" #include "GPS.h" GPS::GPS(PinName tx, PinName rx):_gps(tx,rx) { _gps.baud(9600); _tx=tx; _rx=rx; } int GPS::getGPGGA() { //Serial gps(_tx,_rx); //gps.baud(9600); //if(_gps.readable()) { getGPS[0]='\0'; GPSread=0; while(1) { recvGPS=_gps.getc(); char s[2]; s[0] = recvGPS; s[1] = '\0'; strcat(getGPS, s); if(recvGPS==10) { if((getGPS[4]=='G')&&(getGPS[5]=='A')) { GPSread=1; return 1; } return 0; //break; } } //}//readableの終わり // wait(1); //return 0; }