![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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
Diff: main.cpp
- Revision:
- 0:a67329717e00
diff -r 000000000000 -r a67329717e00 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Nov 29 15:41:50 2017 +0000 @@ -0,0 +1,35 @@ +#include "SoftSerial.h" +#include "SerialGPS.h" +//#include "GPSPARSER.h" + +Serial pc(USBTX, USBRX); + +int main(void) +{ + pc.baud(115200); +#ifdef DEMO_ONLY + SoftSerial *softUART = new SoftSerial(D6, D7); + softUART->baud(9600); + softUART->puts("Hello\r\n"); + while(true){ + int c = softUART->getc(); + softUART->putc(c); + } +#endif + DigitalOut led(D0); + SerialGPS gps(D6, D7, 9600); + + while(true){ + if(gps.sample() > 0){ + pc.printf("Last longitude degrees were... %f\r\n", gps.longitude); + pc.printf("Last latitude degrees were... %f\r\n", gps.latitude); + led = true; + } else { + pc.printf("No lock\r\n"); + led = false; + } + wait(5); + } + + return 0; +}