Track mouse position using ble mouse libray

so i have been doodling with some ble mouse libraries using esp32 and im looking for a away that the mouses cursors position can be tracked from the device so its easier to move the cursors in a specific path and also wont have to deal with having to set the mouse at the right spot and then having to time the movements which is mostly the problem i have with the ble mouse libraries

Hi @connorban. The technique I have used is to start by moving the mouse pointer enough in each direction that it is certain that is is now located at one of the corners of the display regardless of the arbitrary starting position of the pointer. You now have a reference point (e.g., 0,0) from which to base all the relative movements that come after.

The tricky thing I encountered is that, at least with my system which was using the "Mouse" library on a Windows machine, the mouse pointer position did not reflect the coordinates that were expected from the values passed to Mouse.move for larger values. I believe this is due to the operating system's "mouse acceleration" feature. The workaround I found was to only move small distances at a time (calling Mouse.move multiple times in order to achieve movements of larger distances).

This library provides the "homing", incremental movement, and absolute position tracking code:

If what I wrote above is not clear to you, take a look at the library source code. I think it will be more clear after that.

The library uses the "Mouse" library, so probably won't work out of the box for your use case, but it would probably be easy to adapt it for use with whatever BLE mouse library you are working with.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.