We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi Guys, I'm using the Serial library for communication with a gps module that read the latitude and longitude for a processing sketck. The serial library shows the lat and lon in the sketck but I need to assign this data for a variable. Is this possible ??? How can I do that ??? Thanks.
Answers
How is the sketch showing the values you're getting? POST THE CODE.
Can't you just create some variables and save those value?
And here is the code :
On line 49 you are creating a local variable (called location). Then you are getting the Lat and Long values out of it on line 51. It appears like you already have an example of storing location data to a variable! What's not working about it for you? What do you want it to differently?
In the line 49, it's just shows the lat and lon on the screen, it's not so important.... I need for an example, get the string dadosgps(line 41) and assign this data for example, to line 53 ( new location(lat, lon)). that's it I need to do.
Ok. Variable dadosgps is a String, presumable of the format "[lat] [lon]". So start by breaking it into two strings with split(), and save them into a String[]. Then convert each String in that array into a number with float(). Try it!
I think it's like this for example: dadogps is 34.343434,56.565656 (comma separate):