I am tired please help!

hello
It is days I am trying to understand how to read and use an optical sensor.
For optical sensor I mean: (LED --Hole--> photo transistor) * 3.
you can see it in this photos to be more clear and also you can see the gear that the sensor is gonna read:

https://www.facebook.com/marco.tricca.7/media_set?set=a.10151687080623808.1073741825.808623807&type=3

Now,
Is it possible that every web search sends you to the arduino Reading Rotary Encoders page?
I understand the similarity and I've got some good info but at the end I need a simple code to count how many time my encoders(3 signals) are going High and Low and which one goes up first to control my dc motor.
Can someone help me please?
Thansk and sorry but I am trying to learn

http://www.circuitsathome.com/mcu/reading-rotary-encoder-on-arduino

THANKS