The figures above shows the basic idea of any robot, where we have some inputs and output devices connected to the brain and some outputs controlled by the brain. In our case we will have the Arduino like the brain.
The central Brain, controls all movements of the Robot. The sensors will do the monitoring where the light focus is and finally the motors that gives to the robot its movements to go forward, to turn left and to turn right.
The input devices will be LDRs (Light Dependent Resistor) those components have its resistance changed according to the incidence of light on the device. Basically, if there is no incident light, the LDR will have a high resistance (from 200KΩ to 5MΩ more or less), and when the incidence of light the LDR will have a reduced resistance (since some dozens of ohms to rough a few hundreds) as we can see in the LDR's characteristic curve above
A LDR is also sensitive to the wavelength of the incident light, so we can say that it depends on the color of the light.
Step 1: Basic Circuit
In the figure above, we can see the basic circuit for driving an LED using a LDR as light sensor.
In the circuit on the left, initially we can note that the LED is off because the resistance of the LDR without incident light, let the transistor in cut state. When we line up the light focus on the LDR, it will decrease its resistance and thus we have a base polarization, and so the transistor enter in the conducting state, switching the LED on.
In the circuit on the right, we will notice that the LED is initially in the state on, since we have no incident light on the LDR and the LDR have a resistance greater than the sum of resistances of the resistor of 10K + the 10K potentiometer; the transistor base will be polarized driving the LED, and when the light falls on the LDR, the LDR will have a decrease in current and will sustain the transistor into the cut state switching the LED off.
A sensitivity setting in the system is allowed through the 10K potentiometer.
Naturally, we can use the LDR in another way, but this is the most usual form.