using Arduino Uno
#define encoderPin1 8
#define encoderPin2 9
attachInterrupt(0, updateEncoder, CHANGE);
attachInterrupt(1, updateEncoder, CHANGE);
interrupt 0 is pin2 and interrupt 1 is pin 3 on the uno.
Back up a bit, and write a a piece of code which just reads the encoder and writes the count to the screen.
How are you planning to use the encoder counts in your program?
The motor code is "blocking" and this section will prevent other things from happening
step(true,1000);//(direction ,steps per revolution). This is clockwise rotation.
delay(500);
step(false,1000);//Turn (direction ,steps per revolution). This is anticlockwise rotation.
delay(500);