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.
Revision 0:3d25bc7ff80e, committed 2019-07-16
- Comitter:
- Nerosho
- Date:
- Tue Jul 16 12:07:09 2019 +0000
- Child:
- 1:432f77f0d864
- Commit message:
- ver1
Changed in this revision
| GPS.cpp | Show annotated file Show diff for this revision Revisions of this file |
| GPS.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GPS.cpp Tue Jul 16 12:07:09 2019 +0000
@@ -0,0 +1,54 @@
+#include "GPS.h"
+#include "mbed.h"
+
+
+GPS::GPS(PinName tx, PinName rx):gps(tx,rx)
+{
+ _tx=tx;
+ _rx=rx;
+
+}
+
+int GPS::getGPGGA()
+{
+ //Serial gps(_tx,_rx);
+ gps.baud(9600);
+ //Serial pc(USBTX,USBRX);
+ //pc.baud(9600);
+
+ char recvGPS=0;
+ char getGPS[128];
+ //char GPSMessage[128];
+ int i=0;
+
+
+ if(gps.readable()) {
+
+ recvGPS=gps.getc();
+ getGPS[i]=recvGPS;
+
+ if(getGPS[i]==10) {
+
+ if((getGPS[5]==71)&&(getGPS[6]==65)) {
+
+ for(int n=0; n<i+1; n++) {
+
+ GPSMessage[n] = getGPS[n];
+
+
+ }
+ return 1;
+
+ }
+
+ i=0;
+
+ }
+
+ i++;
+ }
+
+ //char eGPSMessage[]= "Could not get GPS data!";
+ return 0;
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/GPS.h Tue Jul 16 12:07:09 2019 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+
+#ifndef GPS_Class
+#define GPS_Class
+
+class GPS
+{
+
+private:
+ Serial gps;
+ PinName _tx; //tx pin name which connected to mbed
+ PinName _rx; //rx pin name which connected to mbed
+ //char GPSMessage[128];
+
+
+public:
+ GPS(PinName tx, PinName rx);
+ int getGPGGA();
+ char GPSMessage[128];
+ //char eGPSMessage[128];
+
+};
+
+#endif
\ No newline at end of file