Hi everyone.
I'm trying to use GPS data coming from PMB-248 GPS Receiver in order to calculate distance to my target. When I use Serial.print(GPS.read(),BYTE); I see all NMEA data. I use char array to store specific parts of the NMEA data, however if I print this char array the displayed data misses every second symbol. I'm using the following code
#include <SoftwareSerial.h>
SoftwareSerial GPS(2,300); // rx pin = 2 for GPS
char tag[6], gpsData[60];
void setup()
{
GPS.begin(4800);
Serial.begin(9600);
}
void GPSRead()
{
while(1)
{
if(GPS.read() == '
The data should come out like this:
183356,4239.4169,N,02321.3495,E,0,00,,00655.8,M,036.9,M,,
but the char array stores only this:
140,2946,,22.45E00,0658M069M,
I'm not sure what I'm missing here...
I'll appreciate your help.
Best regards,
Morwel)
{
for(int i=0;i<6;i++)
{
tag[i] = GPS.read();
}
if(memcmp(tag, "GPGGA,",6) == 0)
{
GPSCollect();
break;
}
}
}
Serial.println(gpsData);
}
void GPSCollect()
{
for(int i=0;i<60;i++)
{
gpsData[i] = GPS.read();
if(GPS.read()=='*')
{
break;
}
}
}
void loop()
{
GPSRead();
}
The data should come out like this:
183356,4239.4169,N,02321.3495,E,0,00,,00655.8,M,036.9,M,,
but the char array stores only this:
140,2946,,22.45E00,0658M069M,
I'm not sure what I'm missing here...
I'll appreciate your help.
Best regards,
Morwel