Line Follower help!?

ok, i have new code for my line follower thanks to my bud. my problem is, it dosnt work when i hold it next to a surface and put it over the line. when i hold it next to a 50 wat like and put my fingers over the photo resistors and take ether finger off it works like it should. what is wrong?

const int deadBand = 25;
const int leftPin = 2;
const int rightPin = 0;

void setup(void)

void loop(void)
  int diff = analogRead(leftPin) - analogRead(rightPin);

  if(abs (diff) < deadBand) {
  } else {
    if(diff < 0){
  delay (100); 

The sensors are seeing differences in light intensity reflecting off the darker or lighter line than the surrounding surface.

If the sensors are mounted in such a way that the light is blocked, the line will not be significantly lighter or darker than the surrounding surface.

Maybe you need to light up the floor.

I recently built a line follower that uses a comparator in lieu of a MCU. After a few prototypes I determined that an array of 4 CdS cells, spaced about 2cm apart, in two series pairs were needed, with supplemental lighting provided by a pair of white LEDs centered between the left and right pairs.

Now that I have an operational line follower, I am learning how to build motor driver circuitry that I can control with Arduino and to modify the sensor array to talk to Arduino as well. But I am a long way out, since I am trying to learn how to program at the same time that I am learning the electronics, neither of which I knew anything about 6 months ago.