BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

GPS position not shown correctly in MAP widget?


#1

Hello, I have a sketch running that gets the location from a GPS device. This data is send into virtual values in Blynk. The V7 String variable contains the location : index, lat, long. Index is set to 1 or 0 (tried both)

I am confused as to what method to use,

Blynk.virtualWrite(V7, V7String,“value”);

OR

myMap.location(1, gps.location.lat(), gps.location.lng(), “value”);

When I use the second method, a cursor is placed somewhere near the coast of Nigeria :slight_smile: … but my device is based in Belgium. I am pretty sure the LAT & LON values are correct.

What am I missing ?

Thanks for your help !

Tony


#2

That means it (the map) is getting something like -1.0 & 0.0 for its coordinates.


#3

Thanks Gunner but the LAT & LON values are also written in V’s so I can see them in my Blynk App and they are OK, they are in the range :

LAT : 51.01xxxx
LON : 4.4xxxxx

Tony


#4

Well, the map command is NOT interpreting them that way… perhaps you need to take your gps.location.lat() and transfer that to a float variable, then use that variable for the map command… same for the gps.location.lng()


#5

Okay will try that ! BUt so Yes, It’s the map command I need to use, right ?


#6

Either or… I usually just use the standard Blynk.virtualWrite() commands for all widgets.

float lat = gps.location.lat();
float lon = gps.location.lng();

Blynk.virtualWrite(V7, 1, lat, lon, "Here be pin");

#7

This works indeed ! But what is the difference then with the myMap.location(1, Current_LAT, Current_LON, “value”); ? And what options do you have with “value” ?


#8

@Tony_Knors:

myMap.location(…) is just a wrapper around a Blynk.virtualWrite(…) in this particular application.
See here:

The “value” is just a string used as a label for the icon on the map. It is shown when you select an icon.


#9

Super ! Thanks !!!