The PID_v1 library includes a useful example where it keeps a heater on for a variable portion of each 5-second interval to keep a steady temperature.
In Tools->Manage Libraries... look for "PID" by Bret Beauregard. After you install it, go to the example:
File->Examples->PID->PID_RelayOutput