trouble with PID library

I'm having an issue using the PID library found here: GitHub - br3ttb/Arduino-PID-Library

i'm controlling the velocity (and position) of a small motor, and i'm able to make everything work with just proportional control, but when I try to add an integral term to improve the performance, it doesn't act as I'd expect. it just ramps up to the output limit (255), and doesn't reduce as the error is reduced. even if the error goes to zero, the output will only increase.

my code is somewhat convoluted and messy at this point, but I will post it if that will help. I was hoping someone might be familiar with the library in question, and perhaps has encountered this problem before. I'm not sure if I'm doing something wrong, or that's just the way the library is meant to work, in which case i'll have to write something myself for this purpose.

From the URL, that sounds like Brett Beauregard's library which lots of people have used successfully, so the issue is likely either your PID parameters or some other issue in your code. For better help, you'll need to post it.

One other possibility is that you're being hit by integral windup q.v.

You want the MUCH improved v2 library:

This version includes I-term anti-windup and a number of other useful features.

You may also still need to add limits on how large the I term can get. For some applications, I've also had to add velocity limits to position PIDs.

Regards,
Ray L.