A discrete-time PID controller for Arduino, implemented via Tustin’s method (the bilinear/trapezoidal transform) rather than a naive forward-Euler discretization — closer tracking of the continuous-time design at the same sample rate.
Includes anti-windup: the integrator clamps (shuts down) once the output saturates, so the controller doesn’t wind up an error term it can’t act on.