Problem with Ps2 mouse library

Hi

I wanted to hack the distance meter in a ps2 mouse . So I downloaded the Ps2 mouse library and It worked perfectly with the example which was included in the library.

My problem is that when I integrate this code with a simple code to control a dc motor , for some reason none of them , the motor and the sensor , works.

I'm not a professional , but I guess there is something wrong with the serial communication.

In the attached file , all the grey parts in the script belongs to the sensor.When I reactive these parts , the motor doesn't work anymore.

I appreciate if anyone has any idea what's wrong!

The_ShotBot_Nozzle.zip (1017 Bytes)

I wanted to hack the distance meter in a ps2 mouse

The what? My mouse doesn't have a distance meter...

but I guess there is something wrong with the serial communication.

What does serial communication do with the ps2 mouse?

Where do you try to control the motor based on the mouse position?

The what? My mouse doesn't have a distance meter...

What does serial communication do with the ps2 mouse?

Where do you try to control the motor based on the mouse position?

sorry ,maybe I should have explained more clear.This is about old mouses that work with a ball , not laser:

http://www.arduino.cc/playground/ComponentLib/Ps2mouse

OK. But, I still don't see anything in the sketch you posted that connects the mouse output to the motors. Does moving the mouse results in any meaningful output on the serial monitor?