Robin2:
I think it is time to ask a basic question - WHY do you want to know the distance from the light source?Maybe if we knew that we could offer some useful solutions.
It is always a bad idea to ask two questions at the same time, but I will take a chance that you will answer both of them - How accurately do you want to measure the distance?
...R
For your 1st question Robin.
What I want to do is this in this project is:
I have x6 LDR(s) that are divided by blocks between each other. 1st LDR front left - 2nd LDR middle - 3rd ldr front right position etc. And if the bright light source is on the 1st LDR then turn left while going forward until the light source position comes to middle 2nd ldr and once the light source is on the 2nd ldr then go forward until it comes closer to light source. In addition, I need to find a reliable way to make dc motors turn right/left until some point then stop. I plan to add a timer to determine how long it will turn turn right/left when the light source is on the desired LDR. However, if you know a better way to do such a thing, I will be very happy if you guide me about this topic too.
Ultrasonic sensor cannot measure distance between light source and the robot where LDRs are located. And at the given task us, it wants us to find the distance between light source and the robot (with LDR help) then follow it and show the distance on the lcd/oled etc.
I have made lot's of research myself first but I didn't get some points so I wanted to ask you here.
For your 2nd question Robin.
Distance measurement will not be perfect with LDR but as long as I can measure a raw distance, that is fine.