19 lines
363 B
Python
19 lines
363 B
Python
|
|
#Qhttps://github.com/tekdemo/MiniPID-Java
|
|
PID = get_context().getClassByName("MiniPID")
|
|
|
|
|
|
target = 41.0
|
|
pid=PID(0.2,0,0)
|
|
pid.setSetpoint(target)
|
|
pid.setOutputLimits(-100, 100)
|
|
while True:
|
|
sensor = out.read()
|
|
|
|
#set some sort of target value
|
|
output=pid.getOutput(sensor)
|
|
print output
|
|
#do something with the output
|
|
inp.write(output)
|
|
time.sleep(1.0)
|