Go Down

Topic: BT HID - XY Click to Mouse Relative Position (Read 1 time) previous topic - next topic


I am working on a project where I am emulating a mouse using Bluetooth HID connected to Android. The mouse movements are relative instead of absolute. So I need to take a XY Click and move the mouse to that location and click.

For testing I am using processing with a draw window the size of the phone but the code should be the same as for Arduino once I try it on hardware. I have a FTDI basic connected directly to the BT Module. I can move the mouse fine if I just send mouse movements tracking the desktop mouse. Now I need to not send a mouse movement unless I click.

I can't access my code right now but here is basically what it does


oldPos middle of screen (where mouse starts)

OnMouse Click (touchscreen touch for final project)

moveX =  oldpos minus currentpos
moveY =  oldpos minus currentpos

then send to BT

That is what I was doing, but noticed that if the distance is far it doesn't move the mouse properly so I though about doing it in hops of till it gets there.

So this is what I came up with but doesn't work and the mouse moves less than it should or does weird stuff

if mouseX greater then 50 then

loop from 1 to moveX

send move mouse

Right now I am trying it for pos X and Y movements

Does this seem like it would work? I am not sure what the max jump can be, somewhere I read -127 to 127.

Here is the BT link with datasheet links

Hope all that makes sense on what I am trying to do.


Current Projects:                    Arduinos:
Security Robot Tank               Uno
Security Robot II 4WD            Mega2560



Check this post: http://arduino.cc/forum/index.php/topic,94140.0.html

I successfully got the absolute mouse mode to work for a USB capable Arduino board (atmega32u4). I can inject absolute mouse movements via USB.

I suspect you might be able to do something similar with your Bluetooth version.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131