I was saying I am getting a null pointer even when the Ardu was connected.
OK, I tried your code, but ‘success’ is not defined. Should we make a bool just for that?
Here
import processing.serial.*;
Serial myPort;
boolean isConnected = false;
int lf = 10;
void setup() {
size(1900, 950, JAVA2D);
printArray(Serial.list());
}
void draw() {
background(0);
if (isConnected == false)
{
try {
Serial myPort = new Serial(this, Serial.list()[0], 115200);
myPort.clear();
if (success) {
isConnected = true;
} else {
delay (3000);
println("NoPORT");
}
}
catch (Exception e) {
delay (3000);
println("NoPORT");
}
} else {
if (myPort.available() > 0) {
String IncomingSTR = myPort.readStringUntil(lf);
println (IncomingSTR);
}
}
}