interfacing ps2 mouse with arduino

hello everyone....
i am doing a project using a ps2 mouse.
i want to get the X and Y coordinates as we move the mouse...
can anyone please help me with codes and libraries of arduino ......
i have these codes but it is not working perfectly

mouse1.ino (1.77 KB)

Have you checked the playground, there are several PS2 articles there

i have these codes but it is not working perfectly

but you don't tell what is wrong...

i have these codes but it is not working perfectly
but you don't tell what is wrong...

  1. Once we start moving mouse X and Y readings increase but max reading we got was 101 in +ve X direction.
  2. Once mouse is halted its origin gets shifted and new position is treated as new origin(0,0).
  3. Also from little search I came to know that optical mouse provides 400 CPI(Counts per Inch) but I think it is pre-scaled in code somewhere.
  1. the codes are the relative movements since the last signal
  2. explained by 1
  3. why not post the link you found.

i got codes from http://www.engineersgarage.com/embedded/arduino/how-to-interface-ps2-mouse-with-arduino