Go Down

Topic: Arduino PS2 mouse interface (Read 654 times) previous topic - next topic

ckiick

Jan 08, 2007, 06:01 pm Last Edit: Jan 08, 2007, 06:03 pm by ckiick Reason: 1
Hi,
  I have posted an article in the playground about how I connected a PS2
mouse to an arduino.  Look for it in the sidebar.

Enjoy,
Chris J. Kiick
Robot builder and all around geek.

CosineKitty

Nice job!  I don't have a PS2 mouse right now, but it was interesting to see how the code worked.  Interesting that both X and Y are a single byte... are they actually X and Y, or are they delta-X and delta-Y since the last time you talked to the mouse?

ckiick

Thanks.

The mouse resets the counters after they are read, so the X and Y are deltas.  Also note that the sign bits for X and Y are in the status byte, so if you care about the direction, you have to check that as well.

It's also possible to get an unsigned 'Z' byte by putting the mouse into a different mode.
I didn't find that very useful, however.

Chris J. Kiick
Robot builder and all around geek.

Go Up