Question

I have a micro-controller (Arduino) and wish to determine automatically to which port the micro-controller locks to. The idea is not to have to correct the COM port manually for every app on every computer. Can this be done ? Thanks !

Was it helpful?

Solution

Do you mean:

  • Micro-controller is an external hardware device
  • User plugs the device into a random serial port (COM port)
  • You want to know which COM port it's connected to

?

Also, you are talking about an old-style COM port, are you, not a USB?

Anyway if that is your question, the only way would be to:

  • Open each COM port on the machine and send data through it, to see (if the micro-controller sends back the expected resonse) whether it's talking to the expected device (e.g. if the device were a modem you might try sending "AT\r" and expect a modem to respond "OK", if there is a modem and if the modem is connected to that serial port).
  • And/or write a device driver or a service to do just this, instead of an application.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top