Optointerrupters and Arduino

Ok, I have a pair of optointerrupter modules (just an IR LED and a photodiode paired together basically) and I would like to find out how to use them as distance sensor with an Arduino. Could anyone set me up with some really basic code that I could play around with just to get me on the right track?

Come on Dent, you should

Come on Dent, you should know to provide more info than just I have generick named part, how can I use this. What is the part number, where did you get it, was there a datasheet for it and where can it be found…

Is it something like this? if so, they have a very short range and may not bee good for long range sensing. Ideally I think they’d be useful for edge detection to prevent you from going over a clif.