el codigo de google maps

Dependencies:   GPS_G mbed

/media/uploads/tony63/tareagsm.png

Committer:
tony63
Date:
Sat May 26 07:00:39 2018 +0000
Revision:
3:0ef0f1632347
Parent:
2:ea6275d1222f
http://maps.google.com/maps?q=6.256791,-75.590302

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tony63 3:0ef0f1632347 1 /*
tony63 3:0ef0f1632347 2 ESTE PROGRAMA TOMA UNA CADENA DE GPS NEMEA
tony63 3:0ef0f1632347 3 Y CREA LA CADENA QUE EN GOOGLE MAPS SE ABRE EL MAPA INDICINDO LA GEOLOCALIZACION
tony63 3:0ef0f1632347 4 lA LIBRERIA GPS, FUE MODIFICADA EN LA ESTRUCUTURA DE DATOS, PARA RECONOCER LA VARIABLE (LOCK)DEL GPS
tony63 3:0ef0f1632347 5 QUE INDICA SI LOS DATOS SON ACEPTABLES
tony63 3:0ef0f1632347 6 EL PROGRAMA SE PRUEBA CON EL GPS VIRTUAL DE PROTEUS
tony63 3:0ef0f1632347 7 Y SE INYECTAN LOS DATOS A UNA FRDMKL25Z ATRAVES DE UN DONGLE QUE SE VINCULA DE FORMA LOGICA AL COMPIM DEL PROTEUS
tony63 3:0ef0f1632347 8 */
procesadores_FAC 0:b2a6aa7c0c8c 9 #include "mbed.h"
procesadores_FAC 0:b2a6aa7c0c8c 10 #include "stdio.h"
procesadores_FAC 0:b2a6aa7c0c8c 11 #include "string.h"
procesadores_FAC 0:b2a6aa7c0c8c 12 #include "GPS.h"
joshema216 2:ea6275d1222f 13
AaronGonzalez 1:e2bd083802c0 14 //Salidas digitales
procesadores_FAC 0:b2a6aa7c0c8c 15 DigitalOut LedVerde(LED2);
procesadores_FAC 0:b2a6aa7c0c8c 16 DigitalOut LedRojo(LED1);
procesadores_FAC 0:b2a6aa7c0c8c 17 DigitalOut LedAzul(LED3);
procesadores_FAC 0:b2a6aa7c0c8c 18
joshema216 2:ea6275d1222f 19 // Declaración de los puertos de la FRDM, Módem y GPS.
procesadores_FAC 0:b2a6aa7c0c8c 20 Serial pc(USBTX,USBRX);
tony63 3:0ef0f1632347 21 GPS gps(PTE0, PTE1); // Puerto del FDRM para el GPS.
procesadores_FAC 0:b2a6aa7c0c8c 22
joshema216 2:ea6275d1222f 23 // Declaración de variables
joshema216 2:ea6275d1222f 24 // Cadenas de caracteres con las que se va a trabajar.
tony63 3:0ef0f1632347 25 char DE1[100];
procesadores_FAC 0:b2a6aa7c0c8c 26
joshema216 2:ea6275d1222f 27 // El GPS entregará al celular coordenadas expresadas en latitud y longitud
joshema216 2:ea6275d1222f 28 // según la ubicación que encuentre, por lo tanto se declaran estas variables.
procesadores_FAC 0:b2a6aa7c0c8c 29 float lo,la;
tony63 3:0ef0f1632347 30 char clo[100], cla[100]; // Cadenas a capturar para latitud y longitud.
tony63 3:0ef0f1632347 31 char la_lo[100];
joshema216 2:ea6275d1222f 32
joshema216 2:ea6275d1222f 33 // Cadena de google maps
tony63 3:0ef0f1632347 34 char http2[100];
procesadores_FAC 0:b2a6aa7c0c8c 35 char http[] = "http://maps.google.com/maps?q=";
joshema216 2:ea6275d1222f 36
joshema216 2:ea6275d1222f 37 // Programas a ejecutar.
tony63 3:0ef0f1632347 38 int main(){
tony63 3:0ef0f1632347 39 LedVerde=1;
tony63 3:0ef0f1632347 40 LedRojo=1;
tony63 3:0ef0f1632347 41 LedAzul=1;
tony63 3:0ef0f1632347 42
tony63 3:0ef0f1632347 43
tony63 3:0ef0f1632347 44 lop1: if(gps.sample()){
joshema216 2:ea6275d1222f 45 lo = gps.longitude;
joshema216 2:ea6275d1222f 46 la = gps.latitude;
tony63 3:0ef0f1632347 47 //pc.printf("\nLongitud entera = %f, Latitud entera = %f\n", lo, la);
tony63 3:0ef0f1632347 48
joshema216 2:ea6275d1222f 49 //LONGITUD
joshema216 2:ea6275d1222f 50 sprintf (clo, "%f", lo);
tony63 3:0ef0f1632347 51
joshema216 2:ea6275d1222f 52 // LATITUD
joshema216 2:ea6275d1222f 53 sprintf (cla, "%f", la);
tony63 3:0ef0f1632347 54
joshema216 2:ea6275d1222f 55 // Concatenando las cadenas de Latitud y Longitud
joshema216 2:ea6275d1222f 56 strcpy(la_lo,cla);
joshema216 2:ea6275d1222f 57 strcat(la_lo,",");
joshema216 2:ea6275d1222f 58 strcat(la_lo,clo);
tony63 3:0ef0f1632347 59
joshema216 2:ea6275d1222f 60 //Ahora se juntan las cadenas obtenidas y se agrega el protocolo de transferencia de hipertextos http
joshema216 2:ea6275d1222f 61 strcpy(DE1,http);
joshema216 2:ea6275d1222f 62 strcat(DE1,la_lo);
joshema216 2:ea6275d1222f 63 pc.printf("\nDireccion: %s\n",DE1);
joshema216 2:ea6275d1222f 64 pc.printf("\n");
tony63 3:0ef0f1632347 65 if(!gps.lock){
tony63 3:0ef0f1632347 66 LedVerde=0;
tony63 3:0ef0f1632347 67 }
tony63 3:0ef0f1632347 68 if(gps.lock){
tony63 3:0ef0f1632347 69 LedVerde=1;
tony63 3:0ef0f1632347 70 }
tony63 3:0ef0f1632347 71
tony63 3:0ef0f1632347 72
tony63 3:0ef0f1632347 73 wait(1.0);
joshema216 2:ea6275d1222f 74
joshema216 2:ea6275d1222f 75 }
joshema216 2:ea6275d1222f 76
tony63 3:0ef0f1632347 77 goto lop1;
tony63 3:0ef0f1632347 78
tony63 3:0ef0f1632347 79 }//del main