Set a function to be called when a threshold is reached.The encoder will pass the current encoder value and the direction of the motor (CW -> 1 , CCW -> 0)