I'm quite a novice in arduino programming. I am doing a small home project and I am using sim808 to obtain GPS data.
My question is quite simple but i can't find any solution online.
Serial.print("latitude :");
Serial.println(sim808.GPSdata.lat, 10);
Serial.print("longitude :");
Serial.println(sim808.GPSdata.lon, 10;
This code display Longitude and Latitude data on serial monitor to 10 decimal place perfectly.
But when after setting the Longitude and Latitude to float.When I use this code, I don't get a valid gps data.
Longitude = (sim808.GPSdata.lon, 10 );
Latitude = (sim808.GPSdata.lat, 10 );
Please help, Thanks.
(edited) I understand my error in coding for the above.
In fact, I am using a DF robot shield sim 808 for vehicle tracking. I am uploading my GPS data, longitude, latitude and speed to Ubidots. The only difficulty is in saving accurate data.
I am using this codes
Longitude = sim808.GPSdata.lon;
Latitude = sim808.GPSdata.lat;
Speedperkm = sim808.GPSdata.speed_kph;
client.add("Longitude", Longitude);
client.add("Latitude", Latitude);
client.add("Speed per Km", Speedperkm);
The code is working fine but only GPS data of 2 decimal place is being uploaded. If data of up to 6 decimal place is uploaded then the system will more accurate.
That my problem that I am trying to solve.
float
has roughly 7-digit resolution. Printing it with 10 decimal places is ludicrous.double
instead offloat
help?double
is the same asfloat
.