Automatically Select Correct Serial Port
in
Contributed Library Questions
•
2 years ago
I'm using the Serial library, and I was wondering if there is a way to automatically select the serial port. The examples I've seen always assume you know which port you want, and that you will select the appropriate one in the Serial.list() array. My problem is that I am trying to export my sketch as an application, and I do not know which port is going to be the right one on any given computer. My first attempt was to open each port and send out a query, and then listen for a defined response from my device, and then select that com port. That worked well enough, until I ran into the problem that some of the other com ports were in use, and processing threw and error and quit. Is there a way to tell if a com port is in use before trying to use it? Or is there a better method to achieve what I am trying to do?
2