That info helped a little bit. Perhaps I’m still missing the obvious? Is it possible to link a YouTube video to explain in detail?
In any case, this is what happens after more experimenting. I cannot get the entire NMEA block
to read into Processing via serialEvent(). It works when moving the code within draw(). Here
are the outputs:
THIS code:
void serialEvent(final Serial s){
inStringGPS = splitTokens(s.readStringUntil(ENTER));
}
and THIS code:
void serialEvent(final Serial s){
while(gpsPort.available() > 0){
inStringGPS = splitTokens(s.readString()); //Until(ENTER));
}
}
Output the following:
[0] "$GPGLL,4355.94453,N,07859.68160,W,171628.00,A,A*72"
[0] "$GPGLL,4355.94453,N,07859.68160,W,171628.00,A,A*72"
[0] "$GPGLL,4355.94453,N,07859.68160,W,171628.00,A,A*72"
[0] "$GPGLL,4355.94453,N,07859.68160,W,171628.00,A,A*72"
[0] "$GPGSV,4,4,16,29,04,028,,31,25,092,29,46,19,240,,51,32,218,*7C"
[0] "$GPGLL,4355.94448,N,07859.68158,W,171629.00,A,A*72"
However, this code gives me:
import processing.serial.*;
Serial gpsPort;
float speedometer;
int gpsHeading;
String[] gpsData = new String[500]; //65
String[] inStringGPS;
void draw() {
background(0);
while(gpsPort.available() > 0){
inStringGPS = splitTokens(gpsPort.readString());
}
gpsData = split(inStringGPS[0], ',');
String blockRMC = gpsData[0];
String str3 = "$GPRMC";
if (str3.equals(blockRMC) == true){ // $GPRMC
gpsHeading = int(gpsData[9]);
speedometer = float(gpsData[7]);
text(gpsHeading, 40, 40);
text(speedometer, 80, 40);
}
printArray(gpsData);
}
[0] "$GPRMC,172645.00,A,4355.94291,N,07859.68291,W,0.010,,060320,,,A*60"
[1] "$GPVTG,,T,,M,0.010,N,0.019,K,A*2A"
[2] "$GPGGA,172645.00,4355.94291,N,07859.68291,W,1,07,1.25,149.7,M,-35.9,M,,*62"
[3] "$GPGSA,A,3,31,03,23,04,09,26,27,,,,,,2.19,1.25,1.80*0B"
[4] "$GPGSV,4,1,15,03,12,224,19,04,70,258,35,07,08,287,,08,16,179,07*7B"
[5] "$GPGSV,4,2,15,09,42,304,29,16,80,047,08,21,04,070,,22,00,206,*78"
[6] "$GPGSV,4,3,15,23,64,269,38,26,50,054,31,27,38,153,29,29,01,026,*71"
[7] "$GPGSV,4,4,15,31,22,096,24,46,19,240,,51,32,218,*44"
[8] "$GPGLL,4355.94291,N,07859.68291,W,172645.00,A,A*7F"
Why is serialEvent missing most of the NMEA data block?