Monterey CA
Offline
Sr. Member
Karma: 0
Posts: 286
Addicted to Arduino
|
 |
« on: February 02, 2012, 02:41:43 am » |
I just recieved a BlueSmrif in HID mode and trying to get it to act like a mouse http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Wireless/Bluetooth/RN-HID-User%20Guidev0%2005.pdfI don't quite understand what to send to send a mouse event. I can get keyboard to work and send text and codes like backspace and volume up just fine. Just confused about the mouse part. I have it in HID mouse mode now. Thanks for any help.
|
|
|
|
« Last Edit: February 02, 2012, 02:44:04 am by MobileWill »
|
Logged
|
|
|
|
|
Monterey CA
Offline
Sr. Member
Karma: 0
Posts: 286
Addicted to Arduino
|
 |
« Reply #1 on: February 02, 2012, 12:19:00 pm » |
Here is what it has for mouse
0xFD 5 bytes 0x2 Buttons X-stop Y-stop Wheel
I get the FD, the 5 bytes is for Length not sure so should it be 0x05? And then the rest I take it would be a hex value for each? I am not sure what the value would be for Buttons X, Y and Wheel
There is an example of a keyboard press and that is
0xFD 0x03 0x03 0x00 0x10 for keydown 0xFD 0x03 0x03 0x00 0x00 for keyup
|
|
|
|
|
Logged
|
|
|
|
|
Monterey CA
Offline
Sr. Member
Karma: 0
Posts: 286
Addicted to Arduino
|
 |
« Reply #2 on: February 10, 2012, 02:07:28 pm » |
In case anyone finds this and wants to know the solution. I was using binary instead of the hex value. The manual needs to be more clear. So for mouse mode I used 0020 and it worked  Other stuff to figure out still, like what the range is for the cursor movement and how to map that to a absolute position.
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Online
Brattain Member
Karma: 334
Posts: 36450
Seattle, WA USA
|
 |
« Reply #3 on: February 10, 2012, 04:38:20 pm » |
like what the range is for the cursor movement and how to map that to a absolute position. The range is, in theory, unbounded. Of course, the actual position is stored in a variable of some type that imposes limits. The absolute position must be determined by adding all the + movements and subtracting all the - movements.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 5
|
 |
« Reply #4 on: March 07, 2012, 07:59:52 pm » |
Hello, I was wondering if you could tell me how you send the hid reports to the bluesmirf. I have been trying to send the report through the uart connection from a terminal window. Instead of the module interpreting the report it justs sends each character as a key press. I have sent 0xFD 0x9 0x1 0x0 0x04 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 to the module which the manual says will send an event that the "a" key has been pressed.
|
|
|
|
|
Logged
|
|
|
|
|
Monterey CA
Offline
Sr. Member
Karma: 0
Posts: 286
Addicted to Arduino
|
 |
« Reply #5 on: March 08, 2012, 11:06:04 am » |
The terminal won't work, you need a terminal program that can send hex values. I use hterm http://www.der-hammer.info/terminal/There are others like this one http://realterm.sourceforge.net/Let me know if you get it work or anything else you need. It was a pain but works great once you get it working.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 5
|
 |
« Reply #6 on: March 08, 2012, 07:05:27 pm » |
Thanks, that worked nicely. I've got my arduino sending events to it now as well.
My only problem with it now is that it does not send back any feedback after sending it any commands. It goes into command mode with $$$ but it doesn't send back the CMD response. I changed the name of the module with the SN command but it does not send back AOK even though the name was successfully changed.
Anyway, at least I know how to send events to it now.
|
|
|
|
|
Logged
|
|
|
|
|
Monterey CA
Offline
Sr. Member
Karma: 0
Posts: 286
Addicted to Arduino
|
 |
« Reply #7 on: March 08, 2012, 07:10:43 pm » |
It should. I had to play with the CR and LF in the terminal app. Sometimes it wants it and others it whats no feed. really odd. Its picky.
I am still trying to figure out a way to translate x,y to be able to send absolute values or at least keep it in sync.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 5
|
 |
« Reply #8 on: March 08, 2012, 08:38:43 pm » |
Should be nothing sent after $$$ but all other commands expect a new line. At least thats what it looks like since the commands are executed I just don't get any feedback. I've sent mouse x and y values from my arduino with byte( val ); I tested it out with this:
buffer[0] = 0xFD; buffer[1] = 0x05; buffer[2] = 0x02; buffer[3] = 0x00; //Buttons buffer[4] = byte( random( 1366 ) ); //X-stop buffer[5] = byte( random( 768 ) ); //Y-stop buffer[6] = 0x00; //Wheel Serial.write( buffer, 7 );
Have you gotten your module to auto connect after a power cycle?
|
|
|
|
|
Logged
|
|
|
|
|
Monterey CA
Offline
Sr. Member
Karma: 0
Posts: 286
Addicted to Arduino
|
 |
« Reply #9 on: March 08, 2012, 08:44:12 pm » |
Really that works? I thought x and y were only distance to move. At least that is how it seems to work for me. What mode are you using for hid?
No and I thought it was supposed. I ended up having the Arduino send a connect command on startup.works well enough.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 5
|
 |
« Reply #10 on: March 09, 2012, 05:40:21 pm » |
Your right, x and y seem to be relative distances. I think I was just moving it so far that it wrapped around maybe? I don't see any way to set an absolute position. I have it in mouse mode for now.
|
|
|
|
|
Logged
|
|
|
|
|
Monterey CA
Offline
Sr. Member
Karma: 0
Posts: 286
Addicted to Arduino
|
 |
« Reply #11 on: March 09, 2012, 05:56:15 pm » |
I am working on a way to translate absolute to relative. The mouse when connected to my phone starts in the middle so just have to track from there. I am testing using processing and just jumping to where I click the mouse. So far its not working so well. I think you can only move so far per command. So I tired to move in smaller jumps to the click location but still not working right.
I think mine is in combo mode. On my phone it won't wrap but I didn't try on a computer.
Haven't had a chance to get back to this project, really need to get this working so I can work on the touchscreen part.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 5
|
 |
« Reply #12 on: March 09, 2012, 08:10:15 pm » |
You can only make small jumps since we only have a byte to store the position. Also my code "byte( random( 1366 ) )" doesn't make any sense since the maximum value would be 256, and since its signed the range is -127 to 127. And that would be why you can only move small distances at a time.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 22
|
 |
« Reply #13 on: February 09, 2013, 07:38:56 am » |
Have you gotten your module to auto connect after a power cycle?
HI guys! For autoconnect you need to put the device in pair mode. You can get that mode by sending the command "SM,6" on the uart. In this mode the module will pair up with the last device. Works well for me.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 22
|
 |
« Reply #14 on: February 09, 2013, 07:45:02 am » |
Hi! I am facing this problem with this module - void setup() { Serial.begin(19200); }
void loop() { Serial.println("aaaaaaaaa"); Serial.println("bbbbbbbbb"); Serial.println("cccccccccc"); }
Now when i try to see this on the serial window, I get aaaaaa bbbbbbbbb ccc aaaaaaaaa bb cccccccc and so on.. A lot of characters are lost When i do this with a SPP module by bluesmirf, I get all the characters. Any idea why this might be happening?
|
|
|
|
|
Logged
|
|
|
|
|
|