Picking up values from TinyGPS++

Hi,

I've been using the excellent TinyGPS++ library for a NMEA GPS project. Whilst I can print the contents of the decoded NMEA sentence easily, how do I perform some math or logic on the data?

For example:

Serial.print(pdopA.value()); // will print the pdop value
printFloat(gpsA.location.lat(); // will print the latitude

but what if I wanted to only print the latitude if the pdop was less than 2.0. I thought something like this:

if (pdopA.value() <= 2.0);
{
printFloat(gpsA.location.lat();
}

but I get an compilation error of : ISO C++ forbids comparison between pointer and integer.

So, I thinks its because I am trying to perform logic on a called value from the library? But as I am fairly new to this I am unsure of how to over come this.

Any help or examples much appreciated !

if (pdopA.value() <= 2.0);

Why is there a semicolon on the end of that statement? What that semicolon does is define what to do when the statement is true. It means noop - do nothing. If the statement is not true, do nothing, too. So, why bother with the test?

Without the ; on the end, the code in the curly braces that starts on the next line is the body of the statement, resulting in radically different behavior.

but I get an compilation error of : ISO C++ forbids comparison between pointer and integer.

Not with the code you posted. Post your REAL code.

Okay, yes my newbie mistake on the ;. Maybe the question I asked was not clear, and the code I posted was a brief outline on how to pick up decoded values by the TinyGPS++ library and not my actual code. It was meant to be an example of trying to pick up the contents of the .value() used in the TinyGPS++ library. I think its a fundamental way on how the library works??

To put my question another way, how do I only continue into the next part of the loop, to print extracted position, only when, for example, the pdop, hdop, or number of satellites is less than or greater than a number I specify?

For reference, the answer was to use the * de-reference operator "value pointed by".

So, instead of:

printFloat(gpsA.location.lat());

do this:

printFloat(*gpsA.location.lat());