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

Dependencies:   mbed

main.cpp

Committer:
giovanniwsn
Date:
2018-05-25
Revision:
0:cc406c7b09be

File content as of revision 0:cc406c7b09be:

/*LIB GPS
author: Giovanni Migon
GPS GP 735T
*/

#include "mbed.h"
#include "GPS.h"

DigitalOut myled(LED1);

GPS gps(p9,p10,9600);
Serial pc(USBTX,USBRX);

// I could not put this method inside the class
void SerialRecvInterrupt (void)
{
    if( gps._serial.readable() ) 
        gps._buf_rx[gps._count_rx++%sizeof(gps._buf_rx)] = gps._serial.getc();
}

int main() {
    myled = 1;
    pc.attach(SerialRecvInterrupt, pc.RxIrq);
    
    while(1) {
        gps.printGPS();
        //gps.printRX();
        wait(1);
    }
}