A simple example of using a MTK3339 GPS module on an adafruit or sparkfun shield installed on a Multitech UDK developer board.

Dependencies:   SerialGPS-SoftSerial SoftSerial

Committer:
pferland
Date:
Wed Nov 29 15:43:14 2017 +0000
Revision:
1:495dfb954d89
Parent:
0:a67329717e00
Initial publish

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pferland 0:a67329717e00 1 #include "SoftSerial.h"
pferland 0:a67329717e00 2 #include "SerialGPS.h"
pferland 0:a67329717e00 3 //#include "GPSPARSER.h"
pferland 0:a67329717e00 4
pferland 0:a67329717e00 5 Serial pc(USBTX, USBRX);
pferland 0:a67329717e00 6
pferland 0:a67329717e00 7 int main(void)
pferland 0:a67329717e00 8 {
pferland 0:a67329717e00 9 pc.baud(115200);
pferland 0:a67329717e00 10 #ifdef DEMO_ONLY
pferland 0:a67329717e00 11 SoftSerial *softUART = new SoftSerial(D6, D7);
pferland 0:a67329717e00 12 softUART->baud(9600);
pferland 0:a67329717e00 13 softUART->puts("Hello\r\n");
pferland 0:a67329717e00 14 while(true){
pferland 0:a67329717e00 15 int c = softUART->getc();
pferland 0:a67329717e00 16 softUART->putc(c);
pferland 0:a67329717e00 17 }
pferland 0:a67329717e00 18 #endif
pferland 0:a67329717e00 19 DigitalOut led(D0);
pferland 0:a67329717e00 20 SerialGPS gps(D6, D7, 9600);
pferland 0:a67329717e00 21
pferland 0:a67329717e00 22 while(true){
pferland 0:a67329717e00 23 if(gps.sample() > 0){
pferland 0:a67329717e00 24 pc.printf("Last longitude degrees were... %f\r\n", gps.longitude);
pferland 0:a67329717e00 25 pc.printf("Last latitude degrees were... %f\r\n", gps.latitude);
pferland 0:a67329717e00 26 led = true;
pferland 0:a67329717e00 27 } else {
pferland 0:a67329717e00 28 pc.printf("No lock\r\n");
pferland 0:a67329717e00 29 led = false;
pferland 0:a67329717e00 30 }
pferland 0:a67329717e00 31 wait(5);
pferland 0:a67329717e00 32 }
pferland 0:a67329717e00 33
pferland 0:a67329717e00 34 return 0;
pferland 0:a67329717e00 35 }