Rotary Encoder and Stepper motor

Hi guys I'm trying to achieve a similar thing but using a optical encoder from a old printer I can read the encoder values when it's moved but can't get any code to work to move the motor or my adafruit driver sheld v2 I basicly want to mimic the turns of the encoder and out put to m1-m2 .
Does anyone have a basic code they could share that will work so I can tweak it to suit my purpose for the life of me I can't get the encoder to communicate to
The motor at all please help me