I wrote a small sketch to display on an LCD the time, date, geographic coordinates, altitude and number of satellites.
Everything is displayed correctly except the altitude and the number of satellites which remain at 0 on the display. However, it is the same NMEA frame ($GPGGA) that gives these values. There is probably an error that I have not found. If anyone has an explanation, I Thank them in advance.
Pierre
You can examine an object’s value at any time, but unless TinyGPS++ has recently been fed from the GPS, it should not be considered valid and up-to-date. The isValid() method will tell you whether the object contains any valid data and is safe to query.
Similarly, isUpdated() indicates whether the object’s value has been updated (not necessarily changed) since the last time you queried it.
Lastly, if you want to know how stale an object’s data is, call its age() method, which returns the number of milliseconds since its last update. If this returns a value greater than 1500 or so, it may be a sign of a problem like a lost fix.
With another sketch, I decode the frames with 9 satellites in view, that's not the problem. On the LCD, I read perfectly the date, time, latitude, longitude but for the altitude and the nbr_sat, it's perpetually zero.
You see, as I recall the location is updated when the RMC sentence is encoded, so your program then goes off and does a pile of stuff, but by the time the program gets back to reading the GPS characters the GGA sentence can have been missed.
So before updating a display printing stuff out etc., wait until you can be sure both RMC and GGA have been encoded.