Hi all,
I'm using the Neo 6M in a GPS project. It's working well and I've got one lingering issue. Here's the code in question (copied almost exactly from an example -- which is why I'm a bit confused):
void loop()
{
// This sketch displays information every time a new sentence is correctly encoded.
while (gpsSerial.available() > 0){
if (gps.encode(gpsSerial.read())){
displayInfo();
}
}
...
...
}
I have programmed the GPS to do updates at 5Hz, and I am getting data with 0.2s granularity. The issue is I get repeating data. For example, I'll get three lines for timestamp 1:00:00 and then finally a line for timestamp 1:00:08. Here is some lines from my Serial Log. The displayInfo() function prints all this.
21:04:52.620 -> Location: 40.618953,-111.864372 Date/Time: 2/28/2024 04:04:46.40
21:04:52.780 -> Location: 40.618953,-111.864372 Date/Time: 2/28/2024 04:04:46.40
21:04:52.977 -> Location: 40.618953,-111.864372 Date/Time: 2/28/2024 04:04:46.40
21:04:53.263 -> Location: 40.618953,-111.864372 Date/Time: 2/28/2024 04:04:47.00
21:04:53.415 -> Location: 40.618953,-111.864372 Date/Time: 2/28/2024 04:04:47.00
21:04:53.628 -> Location: 40.618953,-111.864372 Date/Time: 2/28/2024 04:04:47.40
21:04:53.779 -> Location: 40.618953,-111.864372 Date/Time: 2/28/2024 04:04:47.40
21:04:54.013 -> Location: 40.618953,-111.864372 Date/Time: 2/28/2024 04:04:47.40
21:04:54.283 -> Location: 40.618957,-111.864372 Date/Time: 2/28/2024 04:04:48.00
21:04:54.431 -> Location: 40.618957,-111.864372 Date/Time: 2/28/2024 04:04:48.00
21:04:54.646 -> Location: 40.618957,-111.864372 Date/Time: 2/28/2024 04:04:48.40
21:04:54.804 -> Location: 40.618957,-111.864372 Date/Time: 2/28/2024 04:04:48.40
21:04:55.049 -> Location: 40.618957,-111.864372 Date/Time: 2/28/2024 04:04:48.80
21:04:55.205 -> Location: 40.618957,-111.864372 Date/Time: 2/28/2024 04:04:48.80
21:04:55.427 -> Location: 40.618957,-111.864372 Date/Time: 2/28/2024 04:04:49.20
21:04:55.586 -> Location: 40.618957,-111.864372 Date/Time: 2/28/2024 04:04:49.20
21:04:55.816 -> Location: 40.618957,-111.864372 Date/Time: 2/28/2024 04:04:49.60
21:04:55.971 -> Location: 40.618957,-111.864372 Date/Time: 2/28/2024 04:04:49.60
21:04:56.168 -> Location: 40.618957,-111.864372 Date/Time: 2/28/2024 04:04:49.60
When I use the uCenter app (manufacturer provided software), I can confirm that I am getting data every 200ms. But when I read out that data in the Arduino IDE, I get these jumps in time.
I'm wondering if it has to do with the gps.encode() function? Should I have a delay between encode attempts? Is there still some data sitting in the software serial that I need to flush?
If the GPS has mediocre signal and doesn't get new location data in 200ms, does it just send over the previous data?
Thanks everyone