e.g this is my code, the problem is that the function writetext in Draw would display text with every new value in new line(which is fine), but i want to keep displaying all the values i get instead of just displaying the latest value recieved.
///////////////////////////////////////
import processing.serial.*;
Serial myPort;
String gps_error = "";
PFont font;
int widthadd = 30 , heightadd = 30 ;
void setup() {
size(1000,500);
myPort = new Serial(this, Serial.list()[0], 9600);
myPort.bufferUntil('\n');
font = createFont(PFont.list()[2],10);
textFont(font);
}
void draw()
{
writeText("GPS Error reading = " + gps_error ); //want to keep the older one and then display next
}
void serialEvent (Serial myPort){
gps_error = myPort.readStringUntil('\n');
// if(gps_error != null){
// gps_error=trim(gps_error);
// }
heightadd = heightadd + 30 ;
if (heightadd == 450)
{
heightadd= 30 ;
widthadd= 200;
}
}
void writeText(String textToWrite)
{
background(255);
fill(0);
text(textToWrite, widthadd, heightadd);
}