Hi - in the example wxTerminal and the serial port re-director, a blocking read is attempted prior to checking for the number of bytes in the receive buffer...
data = self.serial.read(1) # read one, blocking
n = self.serial.inWaiting() # look if there is more
data = data + self.serial.read(n) # and get as much as possible
Why is that necessary? I assume it uses less CPU effort than just checking the inWaiting count each time through the loop?
Log in to post a comment.