This is some nice, universal code that can be used with just about any pan and tilt system and an Arduino. This video is a full walk-through of the code showing you step by step what everything does.
More info, code download and kits at: https://sites.google.com/a/rocketbrandstudios.com/rocket-brand-studios/store/hardware/pan-tilt-kit