rotary.h and rotary.cpp should go in your Arduino/libraries/Rotary folder
Rotary encoder class library for Mega (can be customized for others)