How to Extract some sentences from Serial

Hi.. i'm Angga from Indonesia.

I'want to ask something about Serial.

I have try a GPS Module "Ublox Neo 6M" connected to Arduino using Serial. NMEA Message has been displayed when I run Serial console like Hyperterminal or Putty like this :

$GPGSA,A,3,15,26,02,29,24,,,,,,,,4.35,1.42,4.110C
$GPGSV,3,1,09,02,38,076,33,04,,,20,15,64,326,38,24,46,174,34
47
$GPGSV,3,2,09,25,21,240,26,26,36,019,25,29,35,316,38,30,,,0941
$GPGSV,3,3,09,42,52,078,33
4E
$GPGLL,0703.66034,S,10800.37353,E,072842.00,A,A74
$GPRMC,072843.00,A,0703.66035,S,10800.37290,E,0.073,,151114,,,A
66
$GPVTG,,T,,M,0.073,N,0.135,K,A20
$GPGGA,072843.00,0703.66035,S,10800.37290,E,1,05,1.42,616.7,M,2.7,M,,7E
$GPGSA,A,3,15,26,02,29,24,,,,,,,,4.35,1.42,4.11
0C
$GPGSV,2,1,08,02,38,076,36,15,64,326,41,24,46,174,36,25,21,240,27
7F
$GPGSV,2,2,08,26,36,019,26,29,35,316,41,30,,,08,42,52,078,3640
$GPGLL,0703.66035,S,10800.37290,E,072843.00,A,A
7A
$GPRMC,072844.00,A,0703.66038,S,10800.37267,E,0.035,,151114,,,A66
$GPVTG,,T,,M,0.035,N,0.065,K,A
26
$GPGGA,072844.00,0703.66038,S,10800.37267,E,1,05,1.42,617.5,M,2.7,M,,*7F

my question is : what the technique or function on Arduino, if I want to extract just 1 line $GPRMC.......

like this : $GPRMC,072843.00,A,0703.66035,S,10800.37290,E,0.073,,151114,,,A*66

to become a string variable...

Thanks before.

What you want to do should be easy. Add each character to an array of chars as it arrives and terminate the array with a zero when the sentence is complete or as you go along. If the sentence is not the one you want, determined by the first 5 characters received, then either do not put the characters in the array or put them in the array and discard it.

Depending on what you want to do you may find the TinyGPS library helpful.

yes sir, i was try Tinygps++ on the manual is able to extract specify sentences like $GPRMC but it's not work when i trying. do you have a sample sketch to get by 5 1st character, i want to learn from example.

i was try Tinygps++ on the manual is able to extract specify sentences like $GPRMC but it's not work when i trying.

As far as I can see, TinyGPS should handle the GPRMC sentence without difficulty (I don't have a GPS to hand to try it).

Why do you think it isn't working?

AWOL:
As far as I can see, TinyGPS should handle the GPRMC sentence without difficulty (I don't have a GPS to hand to try it).

Why do you think it isn't working?

yes sir, i was try with this sketch :

#include <TinyGPS++.h>
#include <SoftwareSerial.h>
static const int RXPin = 10, TXPin = 11;
static const uint32_t GPSBaud = 9600;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);
TinyGPSCustom magneticVariation(gps, "GPRMC", 10);
void setup()
{
Serial.begin(9600);
ss.begin(GPSBaud);
}
void loop() {
TinyGPSCustom magneticVariation(gps, "GPRMC", 10);
Serial.print("Magnetic variation is ");
Serial.println(magneticVariation.value());
delay(1000);
}

and my Serial just Display :

Magnetic variation is
Magnetic variation is
Magnetic variation is
Magnetic variation is
Magnetic variation is

empty result...

but if I using to display longitude, alttitude, its work with tinygps library..

void loop() {
 TinyGPSCustom magneticVariation(gps, "GPRMC", 10);

Why are you creating a new instance of TinyGPSCustom on every pass through loop?

Where have you connected gps to the software serial instance, so that the gps instance knows where to get data?