Closed ma6254 closed 1 year ago
The reason is that Read
waits until at least one byte is received:
// Stores data received from the serial port into the provided byte array
// buffer. The function returns the number of bytes read.
//
// The Read function blocks until (at least) one byte is received from <-----
// the serial port or an error occurs.
Read(p []byte) (n int, err error)
As soon as the first byte is received the function will unblock and return that byte. If you want to read a fixed-size string you need to cycle and accumulate until you reach the desired size.
platform: windows 10