I'm doing the rationalization of a scale in C #, I can communicate with code all right, but when I connect, I need to specify the port name, I have other devices connected and the port name varies from machine machine.
Can anyone help me validate the port where the balance is connected?
For the time being I left the static name as COM15, but the port name may change.
I'm opening a connection so it works, but the name can not be static.
//Definindo a porta
SerialPort port = new SerialPort("COM15", 2400, Parity.None, 8,StopBits.One);
//Abrindo a porta
port.Open();
I tried to get the names of all the connected ports, but I can not tell which port is the balance.
//Pegando o nomes das portas conectadas
string[] Portas = SerialPort.GetPortNames();
Is there any way to tell if the connected port is scales?
Note: I use a serial to USB converter cable.