Time of flight will not work with a Arduino. (not close) But I think the idea is to measure the angle between the two lights. That can be converted to distance.
There is information we do not know. Kate90 please send pictures or drawings.
The OP posted over a month ago and has not returned and we don't know what kind of IR sensor is being used but I was thinking about this today.
If the sensor is a simple IR transistor, I am sure that you can get distance (not necessarily very accurately) by simply looking at the analog input - pretty much what this guy has done
here.
If that is what is going on, than the assignment boils down to reading the analog pin twice, 1 sec apart and take the lowest measurement (I don't know, maybe 3 measurements, .5 sec apart and take the lowest). This, to get the input when only the constant IR LED is on. Conversely, take the highest input value to get the input when both LEDs are on. That is easy enough, I guess.
What I do not understand is how the second LED can enhance the measurement. Even if the sensor is capable of discriminating the "angle" as mentioned, since the first LED is only on...you only get no 2nd LED or a mixture of the two, that is both on. Discerning an angle would seem mighty tough. I was looking at how
the Sharp chip works (e.g.
here) but I am not seeing the relationship to the current example.. Again, the sensor has not been identified, but it doesn't seem likely that it is very sophisticated - *drat* I wish people would not post looking for a simple line of code and then never come back
Edited to correct at least some of the text to conform to English when I am leaning too far back in my chair to read the screen.