Serial exceptions
in
Core Library Questions
•
1 year ago
Hi, I am working with the serial library and I can't find how to manage two cases:
1) I try to access a COM that is already busy
2) I have already opened a COM and I physically detach the usb port
In both cases I must use exception so that my code understand that it can't speak with that COM port.
I have googoled a lot but I can't find how to cach those exceptions. Particullary:
1) I know there is a "PortInUseException" in java but how to call it from processing?
2) I can do something like this:
try{
arduinoPort.write("message");
}
or
try{
arduinoPort.readStringUntil('delimiter');
}
but after?
With catch (RuntimeException e) or catch (Exception e) or without try and catch java platform crashes...
these are the links more similar to my problem:
http://blog.makezine.com/2011/01/05/codebox-handling-exceptions-in-proc/
https://forum.processing.org/topic/check-if-serial-port-is-connected
http://www.processing.org/discourse/beta/num_1254138715.html
but unfortunatly no one has solved these problems...
Thank you very much for your help
1) I try to access a COM that is already busy
2) I have already opened a COM and I physically detach the usb port
In both cases I must use exception so that my code understand that it can't speak with that COM port.
I have googoled a lot but I can't find how to cach those exceptions. Particullary:
1) I know there is a "PortInUseException" in java but how to call it from processing?
2) I can do something like this:
try{
arduinoPort.write("message");
}
or
try{
arduinoPort.readStringUntil('delimiter');
}
but after?
With catch (RuntimeException e) or catch (Exception e) or without try and catch java platform crashes...
these are the links more similar to my problem:
http://blog.makezine.com/2011/01/05/codebox-handling-exceptions-in-proc/
https://forum.processing.org/topic/check-if-serial-port-is-connected
http://www.processing.org/discourse/beta/num_1254138715.html
but unfortunatly no one has solved these problems...
Thank you very much for your help
1