and a Sharp IR range finder to control the rear motor so that if it comes to close to the light source it will stop automatically.
This will work.
Another method I have used is this:
if (light_sensors detect a really bright light) // robot is close to light source
How would you do this : if (light_sensors detect a really bright light) // robot is close to light source
so far my coding for my photoresistors looks like this:
if(sensor_left > sensor_right && (sensor_left - sensor_right) > threshold)
PORTD &= !(1<<PD1);
else if(sensor_right > sensor_left && (sensor_right - sensor_left) > threshold))
One other question I have is, If i set a port to low, is it considered to be grounded? If not, is there a way to set a port to ground?