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 linkshttp://www.sparkfun.com/products/10938
Hope all that makes sense on what I am trying to do.