How to detect the direction of rotation with a sensor encoder timing disk (photoelectric speed sensor)?
It seems to be a A/B coding : if A gets high before B, it's one way (count for exemple), and if B gets high before A, it's other way (decount).
So, connect power and ground. Then connect the two wires to input pins :

    int P_A=2; int P_B=3; //Inputs
    long int position = 0; //Position of wheel
    long int lastPosition = 0; //last position of wheel : for speed computing


Notice that one pin must be an hardware interrupt pin (Uno 2 an 3 are interrupt pins. Then attach interrupt in the stup :

    attachInterrupt(2, wheel, RISING);  //wheel is arbitray


Then create the interruption code :

    void wheel(){
        int sB = digitalRead(P_B);
        if (sA == sB)   { //Clockwise
        position++;
        }
        else   { //Counterclockwise
        position--;
        }


Then, in your loop, you can print position when it changes to read current position :

    if(lastPosition != position){
        Serial.println(position);
    }


i hope it will help...
Notice that if you use both interruptions, you get a better resolution, but speed limit is lower.