public static string SearchArduinoPortName() { // Tries to do a ping in each port until it receives a response foreach (string portName in GetPortNames()) { SerialSocket socket = null; bool isArduino; try { socket = new SerialSocket(portName); socket.Open(); isArduino = Ping(socket); } finally { if (socket != null) socket.Close(); } if (isArduino) return portName; } return null; }
internal Programmer(string portName) { Error = ErrorCode.NoError; socket = new SerialSocket(portName); socket.Open(); }