PID controller Sample Time

from the library

PID is one of those simple processes that you can roll your code fairly quickly. So why bother with a "library"?

As to sample time, set up a timer interrupt, and use that to set a flag once your desired time has passed.