while(Serial1.read()!='
The for loop executes as soon as there is one byte to read. You then read 6 of the one bytes available. The likelyhood of all 6 bytes arriving faster than the Arduino can read them is about the same as my winning the lottery two weeks in a row, without buying a ticket.
There is a start of packet marker for every NMEA sentence, the $ sign, and an end of packet marker (left for you to determine). You need to store all the data starting when the start maker arrives, and ending when the end marker arrives. Then, you parse the stored data.);
for(int i=0;i<6;i++)
{
if(Serial1.read()!=GGA[i])
Gflag=false;
}
The for loop executes as soon as there is one byte to read. You then read 6 of the one bytes available. The likelyhood of all 6 bytes arriving faster than the Arduino can read them is about the same as my winning the lottery two weeks in a row, without buying a ticket.
There is a start of packet marker for every NMEA sentence, the $ sign, and an end of packet marker (left for you to determine). You need to store all the data starting when the start maker arrives, and ending when the end marker arrives. Then, you parse the stored data.