Adding more decimals to GPS data in Microsoft Arduino Virtual Shield

The default number of decimal places for the example named Basic-GPS for the Microsoft Arduino Virtual Shield is 2 decimal places. This means that the accuracy of the GPS position is not accurate by 500m to 700m from the right location.

The gps.Latitude and gps.Longitude value can be made more accurate by appending the number of desired decimal places as shown in the figure below. What changed from the original code is

String lat = String(“Lat: “) + String(gps.Latitude);
String lon = String(“Lon: “) + String(gps.Longitude);

to,

String lat = String(“Lat: “) + String(gps.Latitude,6);
String lon = String(“Lon: “) + String(gps.Longitude,6);

capture

The rest of the code are similar to the example, except I use serial.begin(9600) to match with my HC-06 bluetooth baud rate.

Advertisements