PROGRAMA SIMPLE QUE LEE UNA TRAMA DE GPS Y LA PONE EN PANTALLA DE LA TERMINAL DEL PC

Dependencies:   GPS7 mbed

Fork of GPS_HelloWorld by Simon Ford

main.cpp

Committer:
tony63
Date:
2015-04-27
Revision:
2:5abd8a794703
Parent:
1:99bb5d61015f

File content as of revision 2:5abd8a794703:

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

Serial pc(USBTX, USBRX);
GPS gps(PTE22, PTE23);
float frac_long, frac_lat;
int main() {
    while(1) {
        if(gps.sample()) {
            pc.printf("longitud_entera=%d, Latitud entera=%d\n", (int)gps.longitude, (int)gps.latitude);
            frac_long=gps.longitude-(int)gps.longitude;
            pc.printf("Longitud Fraccionaria=%d\n", (int)abs(1000000*frac_long)); 
            frac_lat=gps.latitude-(int)gps.latitude;
            pc.printf("Latitud fraccionaria=%d\n", (int)abs(1000000*frac_lat)); 
        } else {
            
            pc.printf("Oh Dear! No lock :(\n");
        }
    }
}