DarrK
1
Hello.I use tinygps plus library my project =>Releases · mikalhart/TinyGPSPlus · GitHub
There are two codes.
// (gps.location.lat(), 4),
// (gps.location.lng(), 4)
How to these values to assign a variable float ? I need 4 digits after the decimal point.How to use?
Example:
float x=4,1234
float y=8,7812
Thanks.
system
2
There are two codes.
// (gps.location.lat(), 4),
// (gps.location.lng(), 4)
That is nonsense. Why do you think that "(gps.location.lat(), 4)" means anything?
How to these values to assign a variable float ?
float lat = gps.location.lat();
I have no idea about lng...
I need 4 digits after the decimal point.
That is nonsense. The number of digits after a decimal point is something that matters ONLY when printing a value.
DarrK
3
PaulS:
That is nonsense. Why do you think that "(gps.location.lat(), 4)" means anything?
float lat = gps.location.lat();
I have no idea about lng...
That is nonsense. The number of digits after a decimal point is something that matters ONLY when printing a value.
Very thanks .I find solution thanks to you .
example:
double x=gps.location.lat(); // gps.location.lat() is double type, latitude coordinate;
double y=gps.location.lng(); //gps.location.lng() is double type,longtitude coordinate;
Serial.print(x,4);
Serial.print(y,4);
DarrK:
Example:
float x=4,1234
float y=8,7812
Remember, you have to be American and use decimal points instead. Like this:
Example:
float x=4.1234
float y=8.7812