{"id":145,"date":"2019-08-28T08:37:18","date_gmt":"2019-08-28T08:37:18","guid":{"rendered":"http:\/\/www.danibeltra.com\/?p=145"},"modified":"2019-08-29T08:37:41","modified_gmt":"2019-08-29T08:37:41","slug":"obtencion-de-datos-gps-con-la-placa-itead-gps-shield-1-1-y-arduino-mega","status":"publish","type":"post","link":"https:\/\/www.danibeltra.com\/?p=145","title":{"rendered":"Obtenci\u00f3n de datos Gps con la  placa ITEAD GPS Shield 1.1 y Arduino Mega."},"content":{"rendered":"<div class=\"d01b6de6d841a687c79c6c1b0fb3f31f\" data-index=\"1\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n<script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({\r\n          google_ad_client: \"ca-pub-0255821013702972\",\r\n          enable_page_level_ads: true\r\n     });\r\n<\/script>\n<\/div>\n\n<p><strong>Materiales utilizados:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.itead.cc\/wiki\/Arduino_GPS_shield\">Itead Studio GPS Shield 1.1<\/a><\/li><li><a href=\"https:\/\/store.arduino.cc\/mega-2560-r3\">Arduino Mega 2560<\/a><\/li><\/ul>\n\n\n\n<p><strong>Conexionado:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"986\" src=\"https:\/\/www.danibeltra.com\/wp-content\/uploads\/2019\/08\/CableadoArduinoGPSShield_bb-1024x986.png\" alt=\"\" class=\"wp-image-148\" srcset=\"https:\/\/www.danibeltra.com\/wp-content\/uploads\/2019\/08\/CableadoArduinoGPSShield_bb-1024x986.png 1024w, https:\/\/www.danibeltra.com\/wp-content\/uploads\/2019\/08\/CableadoArduinoGPSShield_bb-300x289.png 300w, https:\/\/www.danibeltra.com\/wp-content\/uploads\/2019\/08\/CableadoArduinoGPSShield_bb-768x740.png 768w, https:\/\/www.danibeltra.com\/wp-content\/uploads\/2019\/08\/CableadoArduinoGPSShield_bb.png 1146w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Descripci\u00f3n de la aplicaci\u00f3n:<\/strong><\/p>\n\n\n\n<p>En cierta aplicaci\u00f3n, necesito ver por el monitor serie del IDE de Arduino la recepci\u00f3n de datos de la ITEAD GPS Shield 1.1, para ello, realizo el cableado seg\u00fan indico en la imagen. La shield ha de estar pinchada en el Arduino Mega en su ubicaci\u00f3n.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;TinyGPS.h>\n#include &lt;SoftwareSerial.h>\n\nTinyGPS gps;\nSoftwareSerial serialgps(69, 68); \/\/Pin 69 equivale a A15 en arduino mega.\n\nfloat latitud, longitud;\nchar LONGITUD_GPS[12];\nchar LATITUD_GPS[12];\nchar VELOCIDAD_GPS[5] = {'0', '0', '0', 0, 0};\nchar RUMBO_GPS[5] = {'0', '0', '0', 0, 0};\nchar HORA_GPS[4] = {'0', '0', 0, 0};\nchar MINUTOS_GPS[4] = {'0', '0', 0, 0};\nchar SEGUNDOS_GPS[4] = {'0', '0', 0, 0};\nchar DIA_GPS[4] = {'0', '0', 0, 0};\nchar MES_GPS[4] = {'0', '0', 0, 0};\nchar ANO_GPS[6] = {'0', '0', '0', '0', 0, 0};\n\nint year;\nbyte month, day, hour, minute, second, hundredths;\n\nvoid setup()\n{\n    serialgps.begin(9600);\n    Serial.begin(9600);\n}\n\nvoid loop(){\n   \n    bool newData=false;\n    unsigned long chars;\n    unsigned short sentences, failed;\n    \n    for (unsigned long start = millis(); millis()-start&lt;1000;)\n    {\n       while(serialgps.available()){\n         {\n           char c=serialgps.read();\n           if (gps.encode(c)){\n             Serial.println(\"\");\n \n            \/\/obtengo y muestro la latitud y la longitud\n             gps.f_get_position(&amp;latitud, &amp;longitud);\n             char latitudChar[10]= \"\";\n             dtostrf(latitud,4,6,latitudChar);\n             Serial.print(\"Latitud: \");\n             Serial.println(latitudChar);\n             char longitudChar[10]= \"\";\n             dtostrf(longitud,4,6,longitudChar);\n             Serial.print(\"Longitud: \");\n             Serial.println(longitudChar);\n             \n             \/\/obtengo y muestro la velocidad en nudos \n             int velocidad_gps = int(gps.f_speed_knots());\n             sprintf(VELOCIDAD_GPS, \"%03u\", velocidad_gps);\n             Serial.print(\"Velocidad: \");\n             Serial.println(velocidad_gps);\n             \n             \/\/Obtengo y muestro el rumbo.\n             sprintf(RUMBO_GPS, \"%03u\", int(gps.f_course()));\n             Serial.print(\"Rumbo: \");\n             Serial.println(RUMBO_GPS);\n             \n             \/\/Obtengo la fecha y la muestro usando el Serial.print\n             gps.crack_datetime(&amp;year, &amp;month, &amp;day, &amp;hour, &amp;minute, &amp;second, hundredths);\n             sprintf(ANO_GPS, \"%u\", year);\n             sprintf(DIA_GPS, \"%02u\", day);\n             sprintf(MES_GPS, \"%02u\", month);\n             sprintf(HORA_GPS, \"%02u\", hour);\n             sprintf(MINUTOS_GPS, \"%02u\", minute);\n             sprintf(SEGUNDOS_GPS, \"%02u\", second);\n             Serial.print(\"Fecha: \");\n             Serial.print(DIA_GPS);\n             Serial.print(\"\/\");\n             Serial.print(MES_GPS);\n             Serial.print(\"\/\");\n             Serial.println(ANO_GPS);\n \n             \/\/muestro la hora usando concatenacion\n             String horaActual=\"\";\n             horaActual.concat(HORA_GPS); \n             horaActual.concat(\":\");\n             horaActual.concat(MINUTOS_GPS);\n             horaActual.concat(\":\");\n             horaActual.concat(SEGUNDOS_GPS);\n             Serial.print(\"Hora: \");\n             Serial.println(horaActual);\n \n           }\n         }\n       }\n    } \n}\n<\/code><\/pre>\n\n\n\n<div class=\"wp-block-file aligncenter\"><a href=\"https:\/\/www.danibeltra.com\/wp-content\/uploads\/2019\/08\/PruebaGPSItead.ino_.zip\">Fichero del ejemplo:<\/a><a href=\"https:\/\/www.danibeltra.com\/wp-content\/uploads\/2019\/08\/PruebaGPSItead.ino_.zip\" class=\"wp-block-file__button\" download>Descarga<\/a><\/div>\n<!--CusAds0-->\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Materiales utilizados: Itead Studio GPS Shield 1.1 Arduino Mega 2560 Conexionado: Descripci\u00f3n de la aplicaci\u00f3n: En cierta aplicaci\u00f3n, necesito ver por el monitor serie del IDE de Arduino la recepci\u00f3n de datos de la ITEAD GPS Shield 1.1, para ello, realizo el cableado seg\u00fan indico en la imagen. La shield ha de estar pinchada en &hellip; <a href=\"https:\/\/www.danibeltra.com\/?p=145\" class=\"more-link\">Sigue leyendo <span class=\"screen-reader-text\">Obtenci\u00f3n de datos Gps con la  placa ITEAD GPS Shield 1.1 y Arduino Mega.<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"spay_email":"","footnotes":""},"categories":[6,55,17],"tags":[],"class_list":["post-145","post","type-post","status-publish","format-standard","hentry","category-arduino","category-gps","category-programacion"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.danibeltra.com\/index.php?rest_route=\/wp\/v2\/posts\/145","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.danibeltra.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.danibeltra.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.danibeltra.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.danibeltra.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=145"}],"version-history":[{"count":7,"href":"https:\/\/www.danibeltra.com\/index.php?rest_route=\/wp\/v2\/posts\/145\/revisions"}],"predecessor-version":[{"id":158,"href":"https:\/\/www.danibeltra.com\/index.php?rest_route=\/wp\/v2\/posts\/145\/revisions\/158"}],"wp:attachment":[{"href":"https:\/\/www.danibeltra.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.danibeltra.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.danibeltra.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}