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

Dependencies:   GPS7 mbed

Fork of GPS_Google_Cadenas by Gustavo Ramirez

Committer:
tony63
Date:
Mon Apr 27 02:09:46 2015 +0000
Revision:
2:5abd8a794703
Parent:
1:99bb5d61015f
Child:
3:d7d5111a39ac
cordenadas de gps en enteros para google maps

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 0:6b7345059afe 1 #include "mbed.h"
simon 0:6b7345059afe 2 #include "GPS.h"
simon 0:6b7345059afe 3
simon 0:6b7345059afe 4 Serial pc(USBTX, USBRX);
tony63 1:99bb5d61015f 5 GPS gps(PTE22, PTE23);
tony63 2:5abd8a794703 6 float frac_long, frac_lat;
simon 0:6b7345059afe 7 int main() {
simon 0:6b7345059afe 8 while(1) {
simon 0:6b7345059afe 9 if(gps.sample()) {
tony63 2:5abd8a794703 10 pc.printf("longitud_entera=%d, Latitud entera=%d\n", (int)gps.longitude, (int)gps.latitude);
tony63 2:5abd8a794703 11 frac_long=gps.longitude-(int)gps.longitude;
tony63 2:5abd8a794703 12 pc.printf("Longitud Fraccionaria=%d\n", (int)abs(1000000*frac_long));
tony63 2:5abd8a794703 13 frac_lat=gps.latitude-(int)gps.latitude;
tony63 2:5abd8a794703 14 pc.printf("Latitud fraccionaria=%d\n", (int)abs(1000000*frac_lat));
simon 0:6b7345059afe 15 } else {
tony63 1:99bb5d61015f 16
simon 0:6b7345059afe 17 pc.printf("Oh Dear! No lock :(\n");
simon 0:6b7345059afe 18 }
simon 0:6b7345059afe 19 }
simon 0:6b7345059afe 20 }