Measure Movement on your Arduino with a Mouse - How to connect a standard mouse to an Arduino.

Опубликовано: 09 Октябрь 2024
на канале: Bytes N Bits
14,456
437

A mouse is a multi axis movement sensor that can be used for so much more than an on screen pointer. It's incredibly cheap and very accurate. Connect one to your project and you're instantly able to measure your robot's travel, speed, etc. without having to resort to expensive incremental encoders.

I'll show you how to interface with a standard wired mouse, give you free access to my PS/2 mouse library code to drive it and then use it to prototype my spinner control for an arcade game controller project (one for the near future!).

00:00 Introduction
00:39 What can you use a mouse for?
01:40 USB vs PS/2
02:10 What's inside the mouse?
05:23 PS/2 Mouse library for Arduino
06:50 Load the example code
09:52 Reading movement data from the mouse
12:10 Reading the mouse buttons
13:09 Using the mouse as a mouse with an LCD panel
14:53 Creating a spinner control for breakout
15:26 Conclusion

Check out my project page for this video at
https://bytesnbits.co.uk/arduino-ps2-...

Original mouse library this one is based on
https://github.com/kristopher/PS2-Mou...

My updated and expanded mouse library
https://github.com/getis/Arduino-PS2-...

SPI LCD screen setup tutorial
   • Connect an SPI TFT with Touchscreen t...  

LCD Breakout game
   • Coding Games on an ILI9341 SPI LCD an...