PS/2 Mouse to Arduino

I had been looking for code to read a PS/2 mouse from an Arduino, so I could use the mouse buttons and wheel instead of separate switches and a rotary encoder in a VFO. The example code that goes with the PS2 mouse library is great as far as it goes, for the motion and wheel encoders, but only has the following to say about buttons:

You'll need to look on-line for detail of the PS2 protocol in order to interpret the data. The status byte contains the sign bits for the X and Y values, and also the button states.

Yeah, great, thanks guys. A worked example would have been nice, but that was enough to get me started. After a few dead-ends and much optimisation, here it is.

Oh, and it's also my first Arduino coding project.

Code can be found here.

Comments

Popular posts from this blog

First stab at mousewheel-controlled AD9850 Arduino VFO

First Post!