I am trying to make an oled gps display, however when looking at multiple examples and other people's code, I am seeing that people are using different methods. I see some code that has gps.encode(ss.read()); and other people use if gps.encode(ss.read()). I am confused on why this is. Also, people either use .isUpdated, or .isValid, when checking for location/speed, etc. On the TinyGPS++ page it talks about these, but does not say what should be used for certain applications.

  • 1
    it's not really about what should be used for certain application ... it is about what does it do? ... the library takes serial input data and assembles it into a GPS data structure ... certain "flags" are set as the GPS data is assembled, if data has changed ... if a certain function is useful in your program, then use it ... there is no specific use for any of the functions ... so your best start is to learn what ss.read() does, then what gps.encode() does, and so on.
    – jsotola
    Oct 10, 2020 at 1:18

1 Answer 1


From http://arduiniana.org/libraries/tinygpsplus/

Validity, Update status, and Age 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.