Hi all,
I'm try to used Arduino interface with the GPS module. My Arduino read NMEA data from GPS module and display on serial monitor.
This is my Arduino code:
#include <SoftwareSerial.h>
SoftwareSerial gpsSerial(2, 3);
char buffer[90];
int i;
void setup() {
Serial.begin(9600);
gpsSerial.begin(9600);
}
void loop() {
readline();
Serial.println(buffer);
}
void readline(void) {
char c;
char bufferindex = 0;
if (bufferindex == 0) {
while (c != '
And this is output:
$
GPRMC,171319.00,A,1351.49109,N,10039.37870,E,0.167,,150314,,,A*7D
$
GPVTG,,T,,M,0.167,N,0.309,K,A*29
$
GPGGA,171319.00,1351.49109,N,10039.37870,E,1,09,1.00,11.1,M,-27.6,M,,*44
$
GPGSA,A,3,02,07,01,04,09,17,08,20,28,,,,1.78,1.00,1.47*00
$
GPGSV,4,1,13,01,14,034,15,02,14,227,31,04,54,242,19,07,23,169,24*7C
$
GPGSV,4,2,13,08,50,191,18,09,48,203,22,10,19,185,,17,37,334,34*70
$
GPGSV,4,3,13,20,29,071,21,26,03,250,,28,60,031,29,30,46,187,31*78
$
GPGSV,4,4,13,32,00,047,*49
$
GPGLL,1351.49109,N,10039.37870,E,171319.00,A,A*66
But, I want output like this:
$GPRMC,171319.00,A,1351.49109,N,10039.37870,E,0.167,,150314,,,A*7D
$GPVTG,,T,,M,0.167,N,0.309,K,A*29
$GPGGA,171319.00,1351.49109,N,10039.37870,E,1,09,1.00,11.1,M,-27.6,M,,*44
$GPGSA,A,3,02,07,01,04,09,17,08,20,28,,,,1.78,1.00,1.47*00
$GPGSV,4,1,13,01,14,034,15,02,14,227,31,04,54,242,19,07,23,169,24*7C
$GPGSV,4,2,13,08,50,191,18,09,48,203,22,10,19,185,,17,37,334,34*70
$GPGSV,4,3,13,20,29,071,21,26,03,250,,28,60,031,29,30,46,187,31*78
$GPGSV,4,4,13,32,00,047,*49
$GPGLL,1351.49109,N,10039.37870,E,171319.00,A,A*66
Please help me to fix the output.) {
c = gpsSerial.read();
if (c == -1)
continue;
Serial.print(c);
if (c == '\n')
buffer[bufferindex+1] = 0;
bufferindex++;
if (bufferindex == 89) {
Serial.print('!');
bufferindex = 0;
}
}
}
}
And this is output:
§DISCOURSE_HOISTED_CODE_1§
But, I want output like this:
§DISCOURSE_HOISTED_CODE_2§
Please help me to fix the output.