# This line reads the amount of data specified by bytes_to_read in. While bytes_to_read <</a> serial_port.inWaiting(): # command it had to iterate through the loop twice before all the data arrived. # higher value than what is in bytes_to_read we know that more data is still coming in. This loop sleeps 1 second each iteration and updates bytes_to_read.
# 9600 baud is not very fast so if you call serial_port.inWaiting() without sleeping at all it will likely just say # Give the line a small amount of time to receive data # Make sure there is not any lingering input - input in this case being data waiting to be received Serial_port = serial.Serial( 2, baudrate= 9600, timeout=None, parity=serial.PARITY_NONE, bytesize=serial.EIGHTBITS, stopbits=serial.STOPBITS_ONE, xonxoff=False)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |