I have a sketch that talks to an Arduino. I would like it to stop and warn me when the arduino is not present so I tried:
void setup() {
size(1900, 950, JAVA2D);
printArray(Serial.list());
if (Serial.list().length > 0)
{
serialConnect =true;
myPort = new Serial(this, Serial.list()[0], 115200);
myPort.bufferUntil(lf);
//myPort = new Serial (this, "/dev/tty.wchusbserial5d10", 115200);
myPort.clear();
IncomingSTR= "";
} else
{
textSize(26);
text ("CONNECT RECEIVER"+"\n", 10, 40);
delay (3000);
exit();
}
When the Arduino is connected the sketch is fine.
When there is no ardu, I am still finding a COM port and the sketch gives me a bare screen and no warnings.
In the print bottom I get
=======================================================
[0] āCOM27ā
RuntimeException: Error opening serial port COM27: Port not found
In device manager, the āPorts COM and LPTā is not even there⦠when there is no Arduino.
So where the heck is processing finding a port?
Thanks
Mitch