Dear all,
I am kind of stuck with a question, I am trying to decode NMEA data that comes in over software serial, This data needs to be further spread, the given input is the following:
$GPGGA,171751.148,5231.230,N,01323.004,E,1,12,1.0,0.0,M,0.0,M,,*64
$GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30
$GPRMC,171751.148,A,5231.230,N,01323.004,E,,,221220,000.0,W*71
When I send this data and simply use the Serial.prinln function instead of the newSerial println ,I get the same input as output which I want, If I use newSerial.println I am only getting the first string as result so
$GPGGA,171751.148,5231.230,N,01323.004,E,1,12,1.0,0.0,M,0.0,M,,*64
Used code:
SoftwareSerial newSerial(8, 7); // RX | TX
void setup() {
newSerial.begin(19200);
Serial.begin(19200);
}
void loop() {
if (newSerial.available() > 0 ) {
// read incoming character from GPS and feed it to NMEA type object
if (gps.decode(newSerial.read())) {
newSerial.println (gps.sentence());
}
}
}
I agree it might be a silly thing to read the data and send the data back over the same connection, but it's simply neccesary for my hardware that I attach to these serialPort, now I am curious why I only get the first string as result, is this due I am reading and sending to the socket at the same time, do I need to buffer/queue these messages somehow?
Thanks in advance,