1

I have a USB mouse which I am using to measure distance travelled by my bot for a project. I followed this blog to get the optical sensor from the mouse from the arduino and interface it with the arduino. In that blog, the USB wire has been removed and the 4 pins (VCC,GND and 2 data) are connected to the arduino

However,I found the code to not be very robust as the mouse doesn't always establish Serial communication with the arduino.

I have a USB host shield for the arduino. Is there any library which will let me get the x and y coordinates of the mouse using the USB protocol?

And if not, then is there a more stable library which will be more robust than the one used in thr blog linked above?

5
  • Serial communication with an USB mouse? Really? A mouse is normally a HID device. I know no mouse, that implements a serial interface. Please show us your code Commented Oct 14, 2019 at 5:47
  • Are you sure that mouse you are using in your project is PS2/2 compatible? Commented Oct 14, 2019 at 8:07
  • @chrisl yes..I followed instructables.com/id/Optical-Mouse-Odometer-for-Arduino-Robot this Commented Oct 15, 2019 at 14:31
  • Yes it is PS2/2 compatible Commented Oct 15, 2019 at 14:31
  • github.com/felis/USB_Host_Shield_2.0 is the library for the USB host shield. Commented Oct 19, 2019 at 8:36

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.