title: Make Python multiprocessing.Pipe between two functions
body: <p>I use a OneWire sensor (ds18b20) to read out a temperature and use it in a PI-algorithm to controll a SSR relay. I want to use a Pipe between the two functions to to send the temperature and make te "Reg" function to run as fast as possible. If I don't use a Pipe the Reg-function waits for the temperature-function (uses 0.75 seconds) and the output gets wrong...
  Can anyone please show me how to use the Pipe function.??</p>
  
  <p>The code:</p>
  
  <pre><code>import time
  import RPi.GPIO as GPIO
  import os
  
  GPIO.setwarnings(False)
  GPIO.setmode(GPIO.BCM)
  GPIO.setup(22, GPIO.OUT)
  
  
  def temperatur(self):
   while True:
  
      tfile = open("/sys/bus/w1/devices/28-00000433f810/w1_slave")
      text = tfile.read()
      tfile.close()
      secondline = text.split("\n")[1]
      temperaturedata = secondline.split(" ")[9]
      temp2 = float(temperaturedata[2:])
      self.temp = temp2 / 1000
      print self.temp
  
  
  def reg(self):
  
    while True:
  
      ek = self.ref - self.temp
      P_del = self.Kp * ek
      I_del = ((self.Kp * self.Syklustid) / self.Ti) * ek
      Paadrag = P_del + I_del
      if Paadrag &gt; 100:
          Paadrag = 100
      if Paadrag &lt; 0:
          Paadrag = 0    
      print "Paadrag: ", Paadrag, "  Temperatur: ", self.temp
      duty = Paadrag / 100.0
      on_time = self.Syklustid * (duty)
      off_time = self.Syklustid * (1.0-duty)
      print "On_time: ", on_time, "  Off_time: ", off_time
      GPIO.output(22, GPIO.HIGH)
      time.sleep(on_time)
      GPIO.output(22, GPIO.LOW)
      time.sleep(off_time
  
  if __name__ == '__main__':
  </code></pre>