Hola amigos, estoy utilizando un arduino leonardo para poder emplear el modulo gps, el que tengo es el Neo-6m V2 pero en el monitor solo despliega CHARS=0 SENTENCES=0 CSUM ERR=0
Estoy empleado la librería SoftwareSerial y los pines 4 (Rx) y 5 (Tx). Quisiera saber que me recomiendan hacer, ya revisé el modulo y no está quemado y las conexiones están bien hechas.
Gracias.
#include <SoftwareSerial.h>
#include <TinyGPS.h>
TinyGPS gps;
SoftwareSerial softSerial(4, 5);
void setup()
{
Serial.begin(115200);
softSerial.begin(9600);
}
void loop()
{
bool newData = false;
unsigned long chars;
unsigned short sentences, failed;
// Intentar recibir secuencia durante un segundo
for (unsigned long start = millis(); millis() - start < 1000;)
{
while (softSerial.available())
{
char c = softSerial.read();
if (gps.encode(c)) // Nueva secuencia recibida
newData = true;
Serial.print("Datooos");
}
}
if (newData)
{
Serial.print("Hay Datos");
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
Serial.print("LAT=");
Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
Serial.print(" LON=");
Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
Serial.print(" SAT=");
Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
Serial.print(" PREC=");
Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
}
gps.stats(&chars, &sentences, &failed);
Serial.print(" CHARS=");
Serial.print(chars);
Serial.print(" SENTENCES=");
Serial.print(sentences);
Serial.print(" CSUM ERR=");
Serial.println(failed);
}