Measuring distance IR

tedo3637:
Hey, guys.
Can i measure distance between 2 diodes one emitting other receiving.
Sketch is something like TV IR remote control but with distance measuring not commands. (2m max distance)

Technically you can but the smallest measurable period of time that you can measure with most of the Arduino boards is a microsecond which is 1 e-6 which is a millionth of a second.
IR is a kind of light that you can't see, the speed of light is constant and it's 299 792 458 m/s.
if you would put those numbers in the equation d=v*t the time period would be a microsecond, the speed is the speed of light and you get that the shortest length that you can measure with this method is 299.8 meters.
consider that the IR LED can't illuminate that much distance and you get that this method is useless, you need either a better timing or a stronger LED, this method used at radars just instead of an IR light beam they use an electromagnetic wave.
But if you want a good and cheap way to measure distances I would recommend using a sonar and not a makeshift radar because the speed of sound is much slower than the speed of light.
Consider buying the HC-SR04 sensor which is a good and reliable sonar module.
Just as a side note:
if you want to measure that way length of 2 meters like you wanted you would need a precision of 6.5 nanoseconds which is something unrealistic.