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);


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


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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s