how do I hook up this optical sensor to my duino?

I got its data sheet http://www.vishay.com/docs/83760/tcrt5000.pdf

I just don't know how to hook this up to my arduino to use it...I have seen sensor's with 3 legs but this is 4 legs any ideas?

Ok try:

E terminal goes to arduino ground pin. Transistor C terminal goes to arduino digital input pin, which must also have it's internal pull-up resistor enabled. Diode C terminal goes to arduino ground pin. Diode A terminal wires to a 100 ohm resistor, other end of resistor wires to a arduino +5vdc pin.

If surface being pointed at is close enough and reflective enough the digital input value will be read as a low, if not it will read as a high.

Lefty

do i HAVE to have that 100 ohm resistor? I have some servos I can control servo direction using the sensor and that way I would know how or if the sensors are working properly and if I have hooked them up the right way..

twirap: do i HAVE to have that 100 ohm resistor? I have some servos I can control servo direction using the sensor and that way I would know how or if the sensors are working properly and if I have hooked them up the right way..

The emitter is a simple IR LED, all LEDs need a series resistor to limit the current flow to the safe current value they are designed to operate at. No resistor = burned out LED.

Lefty