I notice code examples that I read after closing and opening SerialPort, where people added Thread.Sleep (1000) to SerialPort.Open () and Close (). As below:
Thread.Sleep(1000);
serialPort1.Open();
Thread.Sleep(1000);
serialPort1.Close();
I can’t find anything. Why do people block the serial port using Thread.Sleep before it gets Open or Close? Is this for some temporary purpose? Should I put Thread.Sleep whenever I read or write to the Serial Port?
source
share