OK

Dependencies:   gps_sample mbed

main.cpp

Committer:
schnf30
Date:
2016-05-02
Revision:
1:828c32336aa2
Parent:
0:5cddc7863ae6
Child:
3:9f6d26f044c7

File content as of revision 1:828c32336aa2:

#include "mbed.h"
#include "Sf_gps.h"

Gps gps(p9,p10);
Serial pc(USBTX, USBRX);
DigitalOut myled(LED1);
#define gps_event // pour utiliser en mode event.

#ifdef gps_event
void Gps_attache()
{
    gps.receive();
}
#endif

int main()
{
    pc.baud(9600);
    pc.printf("Hello, I'm Ok\r\n");
#ifdef gps_event
    gps.attach(&Gps_attache, Serial::RxIrq);
#endif
    while(1) {
#ifndef gps_event
        gps.receive();
#endif
        if (gps.gps_data_ok()) pc.printf("Receive %f, %f, %c ,%f ,%c ,%d, %d\r\n",gps.time(),gps.latitude(),gps.ns(),gps.longitude(),gps.ew(),gps.lock(),gps.nbsattelite());
    }
}