title: How to quickly read single byte serial data using Python
body: <p>I am reading serial data in Python using the following code:</p>
  
  <pre><code>port = "COM11"
  baud = 460800
  timeout=1
  
  ser = serial.Serial()
  ser.port = port
  ser.baudrate = baud
  ser.timeout = timeout
  while 1:
       # Read from serial port, blocking
       data =ser.read(1)
       print data
       # some further processing of data
  </code></pre>
  
  <p>I am sending data at very fast rate but when I use this code I am getting data at a very slow rate, maybe around 2 - 3 data per second. This is too slow because I want to do real time plotting.</p>
  
  <p>So, instead of above code I tried:</p>
  
  <pre><code> while 1:
       # Read from serial port, blocking
       data =ser.read(1)
       data1=(data)
  
  
       # If there is more than 1 byte, read the rest
       n = ser.inWaiting()
       data1 = (data1 + ser.read(n))
       print data1
  </code></pre>
  
  <p>Now the speed at which data is updated is the same but instead of a single byte I am checking a number of bytes in input queue and reading them. I am receiving around 3850 bytes per loop so this one appears much faster to me but in fact it is almost the same, the only change is that I am not reading a greater number of bytes.</p>
  
  <p>I want to read a single byte and check for the real time it was received. To do so I cannot use second method where I use <code>ser.inWaiting()</code>. How can I read single byte data faster than using the approaches above?</p>