Couldn't you just read(x); x number of bytes into some garbage variable?
Hi I do use read, here is part of my code.
for x in range (0,100):
s = ser.read(15)
The problem is that the output does not change value although the input to the serial port is changed. When I did the flushInput() the input to the serial line reflected. Which leads me to two possible theories
1. The data queued in the input buffer must be a lot that is why the rate of "reading" by python is not enough
2. The input buffer remains static and is not accepting new inputs that is why it outputs the same values.
How does the read command work in respect to reading the input buffer? Does it update the buffer everytime data is read?
The input buffer works exactly as any other type of buffer. It fills up with whatever it is reading and stores the information until you read it.
read(size=x) reads x number of bytes from the buffer.
inWaiting() tells you how many bytes are in the buffer waiting to be read
flushInput() clears the buffer and discards all of its contents.
Read over the pyserial informational wiki and you'll see much information to help you. A big concern of mine is how you've set up your serial port. Make sure you set the proper parameters (Baud rate, non-blocking, etc.). Again, pay attention to the wiki page for more details on this.