title: Pyserial read from serial port and write to C program
body: <p>I want to read some data using pyserial and then send the output to a C program using subprocess.</p>
  
  <p>Here is my code (in progress):</p>
  
  <pre><code>from serial import Serial
  import subprocess
  process = subprocess.Popen("./print",stdin=subprocess.PIPE)
  ser = Serial("/dev/ttyAMA0",9600,timeout=2)
  while True:
      if ser.inWaiting!=0:
          ser.read()
  </code></pre>
  
  <p>where <code>print</code> is the C program that simply prints the output (a stepping stone to what I actually want to do).</p>
  
  <p>How do I get it so that I can write the result of <code>ser.read()</code> to the C program?</p>
  
  <p>How do I interpret or use that input?</p>