i want to connect a TCRT5000 to the Arduino. I know how to connect it but i don't know the exact code that i need to use to let the sensor work. So if the sensor get's no signal back a led must be switched on.
don't know the exact code that i need to use to let the sensor work
v = digitalRead(pin);
Where pin is the pin number you have connected the sensor to and v is the sensor value.
I know how to connect it
Do you? The question you posted implies you don't. How have you connected it up and what value of pull up resistor have you used? What value of current limiting resistor have you used in the IR emitter?