Help with extracting coordinates for usage in GPS program

Hi everyone,

I am trying to create an outdoor navigation system, and currently receive coordinates of waypoints to the destinations from an Android phone via bluetooth: SparkFun Bluetooth Mate Silver - WRL-12576 - SparkFun Electronics.

The coordinates come in this form: lat, lon, lat, lon, etc...
eg. 42.234598372, -83.462366634, 42.3454466453463, -84.23451456634, 42.333446473452, --83.456342346.. etc.

I do not know how many coordinates will be sent to the Arduino via Bluetooth, as the number of waypoints to the destination changes. I need to extract the latitude and longitude as pairs, and then use them independently in my GPS program, which I have already created (tested using mock coordinates).
I am not sure how to extract each set of coordinates. I am a relative newcomer to Arduino, so I would appreciate any help you could give me. Please include some example code :slight_smile:

Thanks in advance,


Try looking at: strchr(), strnchr(), and strtok(). Read the descriptions, think about what you're trying to do and write it down, then go back and read the descriptions again. I think you'll know exactly what to do.

There is a shorter method... Go look at the TinyGPS++ library by Mikal Hart... It is a little easier to use... for example time doesn't require a position lock... All My GPS devices can return time as soon as they are powered up... no wait for the position lock required by TinyGPS12... I use the library and It always works well for me..