Pages: [1]   Go Down
Author Topic: BT HID - XY Click to Mouse Relative Position  (Read 892 times)
0 Members and 1 Guest are viewing this topic.
Monterey CA
Offline Offline
Sr. Member
****
Karma: 0
Posts: 321
Addicted to Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

setup

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
http://www.sparkfun.com/products/10938


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

Thanks


Logged

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

http://mobilewill.blogspot.com

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: