-
• #2
Yes, you can. Although by Bluetooth, not USB (as there's not USB port!).
For some reason it doesn't seem to be listed (yet) in the Bluetooth HID docs at
But you can just do:
var mouse = require("ble_hid_mouse"); NRF.setServices(undefined, { hid : mouse.report }); setWatch(function(){ mouse.send(0,0,mouse.BUTTONS.LEFT); // X movement, Y movement, buttons pressed }, BTN, {repeat:true});
-
• #3
Hi @Gordon this does not appear to work. Is it because I have the early Puck.js?
On the Espruino web IDE the following appears when button is pressed.
Uncaught Error: BLE error 0xf (FORBIDDEN)
at line 1 col 104
...0,0,0],function(){a&&a()})})
in function "send" called from line 4 col 34
mouse.send(0,0,mouse.BUTTONS.LEFT);
in function called from system -
• #4
@seanfixer, could you get one of the examples going that are documented on page https://www.espruino.com/BLE+Keyboard? - Afaik, version of PuckJS HW is not a dependency, but version of PuckJS FW is. I assume your FW version is is most recent.
-
• #5
'Is it because I have the early Puck.js?'
Please post the result of
process.env
more info here:
http://www.espruino.com/Reference#process
http://forum.espruino.com/conversations/335009/ -
• #6
Hi - as long as you've got your Puck.js firmware up to date you should be fine.
As @allObjects says it'd be worth trying some other HID devices out to check - but what might be happening is just that for it to work you have to disconnect and then pair the Puck with your OS's bluetooth menu first - otherwise the OS won't pick up that it's now talking to a mouse.
-
• #7
Hi @allObjects, yes I could get the examples going that are documented on page https://www.espruino.com/BLE+Keyboard, they worked fine, sending characters and the interface to the multimedia keys. Yes, my FW is up to date 2v08.119. I have tried installing firmware again just in case. @Gordon I have also tried on another computer with Windows 10 OS (by disconnecting from the IDE and then pairing the Puck with the OS's Bluetooth). When I connect onto an Android phone is does appear to partly work in that I get the cursor/arrow to appear once the button is pressed.
@Robin I have run the command this is what I get.process.env.MODULES.split(',')
=[
"Flash",
"Storage",
"heatshrink",
"net",
"dgram",
"http",
"NetworkJS",
"crypto",
"neopixel"
]Thanks for taking the time to respond.
Sean. -
• #8
Ok, interesting it seems to work on Android. What OS were you trying on originally?
It's possible the OS has some issue with the Mouse device that is presented, so doesn't pair correctly.
-
• #9
@Gordon, yes it works well with Android, I can move with X and Y movement and it will preform a mouse click. But it appears not to work in Windows. The puck will pair to the Windows OS Bluetooth settings, but will not move or mouse click. I tested on Window 10 originally and then on another computer with windows 10. Do you think there could be a problem with the Puck?
-
• #10
Do you think there could be a problem with the Puck?
No, this sounds like a software issue. It's possible that windows doesn't like the HID device profile that the
ble_hid_mouse
reports.In 'Device Manager' do you see any errors? Or is there anything that might give a clue as to why it's not recognised?
-
• #11
Hi @Gordon, yes it looks like a software issue with Windows 10, as its working on Android well. I have updated windows 10 to the latest OS build Version 20H2 but the puck still will not mouse click for me on Windows 10. Device manager shows the puck.js and a Bluetooth Low Energy GATT compliant HID device and indicates "This device is working properly".
Not sure if this is a clue but within Event Viewer it shows a warning; Event 34, BTHUSB
"The local adapter does not support an important Low Energy controller state to support peripheral mode. The minimum required supported state mask is 0x2491f7fffff; got 0x1fffffff. Low Energy peripheral role functionality will not be available."
Anyway it’s too technical for me. -
• #12
There seems to be a known issue with Bluetooth devices after a windows update, maybe this is my problem with puck not working in windows 10.
https://support.microsoft.com/en-us/topic/some-bluetooth-devices-may-fail-to-pair-or-connect-after-applying-june-11-2019-or-later-updates-60b210e8-a2ba-ec40-8b83-26d07ade8540 -
• #13
Thanks for digging into that! What make is your PC?
Not sure if this helps, but:
https://www.tenforums.com/drivers-hardware/91123-bthusb-warning-event-id-34-a.html
It seems that it may not be Puck.js at all, but a problem with your PC. I think what it's saying is windows doesn't trust your Bluetooth adaptor to be able to go into a low power state (eg when the laptop is asleep) so it's not going to let you pair any wireless mice/etc since it thinks they'll end up drawing too much power
-
• #14
Hi @Gordon I have a HP ProBook 450 G3 Notebook PC. It has a Intel r dual band wireless AC 3165 (this is a type of WiFi and Bluetooth combo board). This seems to be a common board on other brands of laptop. On the HP support website there was an update for this adaptor to "fix certain potential security issues", which I updated, but still I had no luck. I even tried the Intel support site and so updated to the very latest driver. I have access to other laptops and so I have also tested the puck on a new Windows surface pro 7 and a Lenovo Ideapad 3 with the same results. Maybe it a thing with later builds of Windows 10. The only device its worked on has been my Android Samsung phone. Anyway I will keep searching online to see if anyone has a solution.
Can I use the puck.js as a remote mouse left click?