GPSlibrary
GPS.cpp
- Committer:
- takepiyo
- Date:
- 2019-08-18
- Revision:
- 4:0893111db5e7
- Parent:
- 1:432f77f0d864
File content as of revision 4:0893111db5e7:
#include "GPS.h" #include "mbed.h" GPS::GPS(PinName tx, PinName rx) { _tx=tx; _rx=rx; _gps(_tx,_rx); } //Serial pc(USBTX,USBRX); //char getGPS[128]; //int i=0; char GPS::getGPGGA() { int i=0; _gps.start(); while(1) { getGPS[i]=_gps.read(); if(getGPS[i]=='\n') { if((getGPS[5]=='G')&&(getGPS[6]=='A')) { for(int n=0; n<i+1; n++) { GPSMessage[n] = getGPS[n]; } //pc.printf("%s",GPSMessage); goto OUT; }//if GAの終わり i=0; }//if \nの終わり i++; } OUT: return GPSMessage; }