For more info on PID go here Arduino Playground - PIDLibrary
Or if you like your logic fuzzy, have a look here