I would want to be able to boot the sketch even if the USB cord is unplugged to my arduino.
Eventually I would write a message “COM Not Available” and maybe make a button to re-connect.
But Processing will stop in the setup.
So I tried:
void setup(){
size(400, 300, JAVA2D);
//myPort0 = new Serial(this, "COM4", 9600);
printArray(Serial.list());
if (Serial.list().length > 0)
{
myPort = new Serial(this,Serial.list()[0], 9600);
myPort.bufferUntil(lf);
//myPort = new Serial (this, "/dev/tty.wchusbserial5d10", 115200);
myPort.clear();
}
else
{myPort.stop();
}
f = createFont("Arial",46,true);
}
But no boot.
Please help,
Thanks