Problem reading interrupts on pin 2 with optical detector

Hello

I have setup 2 optical detectors (QRD1114) as encoders for my differential drive robot. I have an Arduino Uno and I'm using interrupts pins 2 and 3. I connected the sensor on the left wheel to pin 2 and the one from the right to pin 3. However when I open the serial monitor the look at the readings the right sensor is giving correct values but the left sensor is not. If I just turn the left wheel a little bit then I would see values around 200 and then if I turn the wheel a little bit more it would increase to 600. In summary right sensor gives 50 pulses per turn (expected) and the left sensor might give 1000 'pulses'.

After this I put right sensor output in pin 2 and left sensor out in pin 3. In this case I saw left sensor giving me correct results. My Arduino Uno is new and I have also tried other 2 boards getting the same results.

Do you have any idea what might be happening?

sketch_jun09b.ino (624 Bytes)