2017年2月15日 星期三

使用 C# 判斷有那些 Serial Port

    
    SerialPort ComPort = new SerialPort();
    string[] ports = SerialPort.GetPortNames();
    foreach(string portName in ports)
    {
        ComPort.PortName = portName;
        ComPort.BaudRate = 115200;
        ComPort.Parity = Parity.None;
        ComPort.StopBits = StopBits.One;
        ComPort.ReadTimeout = 500;
        ComPort.WriteTimeout = 500;
        try
        {
            ComPort.Open();
            ...
        }
        catch
        {
            ComPort.Close()
         
        }
    }

1 則留言:

  1. Awesome post
    In the Shortest period of time to visit and feel the freshness of Taj Mahal You can choose a option of
    Same Day Jaipur Tour By Car. In 12 hours tour of Agra from Delhi which covered 3 World UNESCO and historical monuments of Agra which is Taj Mahal, Agra Fort And Baby Taj ( Itimad-ud-daulah).
    We have more packages like...
    Same Day Jaipur Tour By Train
    Same Day Agra Tour By Train
    Golden Triangle Tour 3 Night And 4 Days

    回覆刪除