There are times when a feedback loop is helpful to prevent overshoot or wild oscillations of a process, whether temperature, motion, or other type of system. A common solution is a proportional–integral–derivative controller (PID controller).
With this Arduino solution, you tell the PID what to measure (the “Input”,) Where you want that measurement to be (the “Setpoint”,) and the variable to adjust that can make that happen (the “Output”.) The PID then adjusts the output trying to make the input equal the setpoint.
This is a much smoother solution than a simple “read, activate, correct” process.