system
July 10, 2013, 9:05am
1
Guys, I want to parse data sent through the serial connection:
Here's the example sting:
$GPRMC,082354.000,A,1324.9294,N,12135.8584,E,0.0,344.9,100713,,,A*6B
It spits out other data with a different starting header, and I only want the $GPRMC data to be read, and sent to me. plus, I only want these data points:
1324.9294
12135.8584
Another problem is, is that the data should be expressed like this:
13 24.9294 & 121 35.8584
how do I get about this dilemma?
Thanks guys!
You can try using strtok() function and use ',' as token if it is a real string (array of char null terminated).
http://www.cplusplus.com/reference/cstring/strtok/?kw=strtok
system
July 10, 2013, 9:18am
3
You could also look at (or use) the TinyGPS library which already knows how to parse GPS data.
I used a regular expression to parse a similar (or identical) string from my GPS.
I was too lazy to work out dozens of strtok calls, so one regular expression call did it instead.