gps

Dependencies:   mbed gps_event_vitesse

main.cpp

Committer:
schnf30
Date:
2016-05-09
Revision:
0:97a29d1f8dd5
Child:
2:64eaefb1790e

File content as of revision 0:97a29d1f8dd5:

#include "mbed.h"
#include "gps_event_vitesse.h"
#define PCBAUD 9600
#define GPSRX p10
#define GPSTX p9
#define GPSBAUD 9600

Gps gps(GPSTX,GPSRX);
Serial pc(USBTX, USBRX);
DigitalOut myled(LED1);

int main()
{
    pc.baud(PCBAUD);
    gps.baud(GPSBAUD);

    pc.printf("Hello, Gps event.\r\n");
    pc.printf("Patientez attente Gps\r\n");
    while(1) {
        if (gps.sample()) {
            pc.printf("Trame $GPGGA recue ");
            if (gps.lock()) 
                {
                    pc.printf("Gps verouille %f, %f, %c ,%f ,%c ,%d\r\n",gps.time(),gps.latitude(),gps.ns(),gps.longitude(),gps.ew(),gps.nbsattelite());
                    if (gps.vitesse_ok()) pc.printf("Vitesse %fkm/h",gps.vitesse());
                    }
                    
            else pc.printf("Gps non verouille, %d sattelite(s) : %f, %f, %c ,%f ,%c\r\n",gps.nbsattelite(),gps.time(),gps.latitude(),gps.ns(),gps.longitude(),gps.ew());
        }
    }
}