1from simple_pid import PID
2pid = PID(1, 0.1, 0.05, setpoint=1)
3
4# assume we have a system we want to control in controlled_system
5v = controlled_system.update(0)
6
7while True:
8 # compute new ouput from the PID according to the systems current value
9 control = pid(v)
10
11 # feed the PID output to the system and get its current value
12 v = controlled_system.update(control)
13