DEBUG_PORT.print( fix.latitude(), 6 ); prints 36.787551 on the serial monitor
if I assign a float variable to it:
lat = (fix.latitude(), 6 );
and send it to the serial port:
DEBUG_PORT.println(lat); it prints 6
if I assign a float variable to this:
lat = fix.latitude(); it prints 36.79
How do I get a variable to yield results like 36.787551 and not 6 or 36.79 ?
Any help would really be appreciated.
Drop the ",6" and look up the comma operator.
The number of decimal places is not defined in a float, but you can specific how many (n) to print with Serial.print(x, n).
You've used the comma operator inadvertently.
lat = fix.latitude();
is what you want.
Then
Serial.print(lat, 6);
to print more digits.
a7
Thank you much, that solved my issue and it worked perfectly .
I didn't understand how Serial.Print works.
Thanks again !!!
system
Closed
5
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.