0

Lora/GPS Shield + Arduino Uno + PLX-DAQ (latest custom version)

I have a problem on how to generate more than 1/2 decimal output. Currently, I'm trying to generate GPS Lat and Long(code from TinyGPS++) on PLX-DAQ

enter image description here

Just like in the image. Latitude generated in 1/2 decimal places. I'm trying to get more than 2 decimal places.

For example : from 3.2 to 3.123953

Coding link: https://www.dropbox.com/s/rqjpnsc9pg33f9n/Coding.txt?dl=0

Thanks.

1 Answer 1

1

You're talking about the output from this line?

Serial.println( (String) "DATA,DATE,TIME," +flat+ "");

drop the use of the String class and make that two separate print statements. Then you can use the second argument to print to define the precision.

Serial.print("DATA,DATE,TIME,");
Serial.println(flat, 6);

That gets the same end result output going out the serial line, but lets you specify the precision and avoids the nasty String class.

9
  • Okay, one problem solved. Now how do I get Longitude output same as latitude?
    – Zyxcros
    May 21, 2017 at 4:31
  • The same way. Just print it. I can't see where in the code you tried to print longitude so I'm not sure what exactly you want to do there.
    – Delta_G
    May 21, 2017 at 4:37
  • This one. Serial.print("DATA,DATE,TIME,"); Serial.println(flat, 6); //latitude Serial.println(flon,6); //longitude But the output only latitude. It's like longitude output doesn't work.
    – Zyxcros
    May 21, 2017 at 4:40
  • Is it not there at all? Or is it going to the next line? Pay attention to when you use print and when you use println. You should maybe print something in between like a space or a comma or something just to make sure they're separated so you can read them.
    – Delta_G
    May 21, 2017 at 4:43
  • ` float flat, flon; Serial.print("DATA,DATE,TIME,"); Serial.println(flat, 6); Serial.print(","); Serial.print(flon, 6);` this is what i did. Sorry, I'm confuse.
    – Zyxcros
    May 21, 2017 at 4:53

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.