from PID import PID pid=PID(0.1,0,0) pid.SetPoint =20.0 #pid.setOutputLimits(-100, 100) while True: sensor = out.read() #set some sort of target value pid.update(sensor) print pid.output #do something with the output inp.write(pid.output) time.sleep(1.0)