rotary encoder

Sparkfun usually has some documentation and/or sample code for their products (links after the product description).
Did you check there?