a program to get GPS latitude and longitude and precision, with a simple validation.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*LIB GPS
00002 author: Giovanni Migon
00003 GPS GP 735T
00004 */
00005 
00006 #include "mbed.h"
00007 #include "GPS.h"
00008 
00009 DigitalOut myled(LED1);
00010 
00011 GPS gps(p9,p10,9600);
00012 Serial pc(USBTX,USBRX);
00013 
00014 // I could not put this method inside the class
00015 void SerialRecvInterrupt (void)
00016 {
00017     if( gps._serial.readable() ) 
00018         gps._buf_rx[gps._count_rx++%sizeof(gps._buf_rx)] = gps._serial.getc();
00019 }
00020 
00021 int main() {
00022     myled = 1;
00023     pc.attach(SerialRecvInterrupt, pc.RxIrq);
00024     
00025     while(1) {
00026         gps.printGPS();
00027         //gps.printRX();
00028         wait(1);
00029     }
00030 }