Пример #1
0
        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;
        }
Пример #2
0
 internal Programmer(string portName)
 {
     Error = ErrorCode.NoError;
     socket = new SerialSocket(portName);
     socket.Open();
 }