I've been troubleshooting an issue and still having problems. I have 2 GPS modules, GY-GPS6MV2, NEO-6M-0-001. They came from different suppliers, so each has a different antenna. I uploaded the program using the latest Arduino IDE. The led on each GPS blinks, so that's good. However, I'm not displaying any received data using the serial monitor. I imported the TinyGPS library inside the IDE. No problems there. I even bypassed RX on the GPS and jump pin0 RX to pin2 used to receive, bit still no data. The default baudrate is 9600 for gps sensor.
#include <SoftwareSerial.h>
#include <TinyGPS.h>
long lat; // create variable for latitude object
long lon; // create variable for longitude object
SoftwareSerial gpsSerial(2, 3); // create gps sensor connection
TinyGPS gps; // create gps object
void setup()
{
Serial.begin(9600); // connect serial
gpsSerial.begin(9600); // connect gps sensor
}
void loop()
{
while(gpsSerial.available())
{
// check for gps data
if(gps.encode(gpsSerial.read()))
{
// encode gps data
gps.get_position(&lat,&lon); // get latitude and longitude
// display position
Serial.print("Position: ");
Serial.print("lat: ");
Serial.print(lat); // print latitude
Serial.print(" ");
Serial.print("lon: ");
Serial.println(lon); // print longitude
}
}
}
