-
• #2
What is the goal? If you're just trying to control espruino over Bluetooth, you can solder an hc-05 onto the bottom of the espruino board, pair with it and connect via the ide.
-
• #3
I know. But I had a rn-42 instead of a hc05 ;-)
-
• #4
Do you think it's pin compatible with the HC-05?
You can also do
Serial2.setConsole();
and then you can program Espruino via Bluetooth too :) -
• #5
It's not pin compatible (I actually have a photo of how I wired it, but I never managed to understand how to upload to this forum). And yes, I could put the serial there.. but I need it for midi input instead.
Ta -
• #6
Hi Loop, on the photo front create an account on something like photobucket (photobucket.com). Free. Upload the photo there. Grab the link from photobucket and paste in to the popup that appears when you click image.
-
• #7
Photo upload should work (by clicking 'upload a file'), but there was a longstanding bug where you couldn't post an image in the first post of a conversation. That actually got fixed yesterday it seems ;)
-
• #8
Yes, that works (I just tried) but to embed an image in the reply itself the "Image" button wants to point to an http:// address. Would be much more convenient if it could grab an image from the local device and upload it somewhere !
-
• #9
Cool! Enjoy the wiring photo in all its dubious glory!
1 Attachment
-
• #10
Lovely :)
-
• #11
hi there !
aside note on the RN42:
- it seems it can be used as bluetooth hid device from firmware version 6.03+ ( keyboard, gamepad, mouse, mouse+keyboard combo, digitizer, sensor, "use cfg* ?" ) additionally to SPP.
- it also supports switching between spp & hid if the GPIO11 pin is high during power up
( I am currently looking for a way to use an original Espruino board as a bluetooth hid device additionally to a serial one & then remembered it didn't support that, contrary to Pico, WiFi & Puck :/ - so the option of switching between spp & hid is quite nice although we're locked to the supported hid report descriptors .. )
hoping this helps someone ;)
*don't know yet what this stands for ( consumer report ? .. )
- it seems it can be used as bluetooth hid device from firmware version 6.03+ ( keyboard, gamepad, mouse, mouse+keyboard combo, digitizer, sensor, "use cfg* ?" ) additionally to SPP.
-
• #12
Wow, that new firmware sounds great! If you get it working, some kind of module that exposed the functionality would be great (you might even be able to make the API the same as it is for Puck.js/etc)
-
• #13
Hi there !
From what I can read in https://www.forward.com.au/pfod/ArduinoProgramming/FioV3/RN-HID-User%20Guide-1.1r.pdf ( pages 3, 6, 7, 8, 9, 10, 11 & above - total 17 pages ), we could write a module somewhat working as the AT one ( putting the device in command mode if not already to alter some of its params & then back to other mode - be it serial or serial+spp, and also surely wrapping stuff with helpers depending on the hid report descriptor chosen ? .. )
It seems they advise to use a "consumer report" to report additional keys, & also to support "keymap registers" ( page 11 for both )
On the "gamepad" thing, after digging a little, I stumbled upon this, which is perfect for some of us ;)
https://github.com/evankale/BluetoothPS2Controller/blob/master/BluetoothPS2Controller.inoBe sure to check this video for an explanation of the relationship between hc05, rn42 & cie ;)
nb: I'll investigate the subject as soon as I'm done writing a usb gamepad hid report for Espruino ;)
+
-
• #14
back :)
a quick update on the subjetc: I just finished writing a USB HID GamePad module ( yaaaaaayyyyy! ^^ ), and I'll digg that RN42 thing as soon as can do.
this being said, I now better grasp some stuff from the data provided:
using the RN42 HID firmware & sending a 'raw' hid report is done as ( p7 of their manual at https://cdn.sparkfun.com/datasheets/Wireless/Bluetooth/RN-HID-User-Guide-v1.0r.pdf):
// Serial points to either an RN42 or a flashed HC-05 with HID support //E.sendUSBHID([ Serial.write( 0xFD, // indicates raw hid report 0x06, // bLength 0x01, // bDescriptorType - constant ( String assigned by USB ) x1, // Byte0 y1, // Byte1 x2, // Byte2 y2 // Byte3 btnState & 0xFF, // Byte4 (btnState>>8) & 0xFF, // Byte5 ); //]);
to the contrary, USB HID ( & maybe Espruino's bluetooth HID )
E.sendUSBHID([ // 0xFD, // indicates raw hid report //0x06, // bLength //0x01, // bDescriptorType - constant ( String assigned by USB ) btnState & 0xFF, // Byte0 (btnState>>8) & 0xFF, // Byte1 x1, // Byte2 y1, // Byte3 x2, // Byte4 y2 // Byte5 ]);
One good thing to do 'd be summarizing the REALLY interesting parts from their doc to gain a huge amount of scroll time & cie .. ;)
-
• #15
So you wrote something that creates a new
E.sendUSBHID
function? If so, would it make sense to just prepend those first 3 bytes, rather than making the function behave differently? -
• #16
Sorry, I just edited the above code excerpts to better reflect what has to be tried on the RN42 setup and the puck.js setup.
I guess it'd make sense merging all the possible "interfaces" for a gamepad module & pass the chosen one as param ? ( as well as accept a higher-level helper function if needed ? )Ex: possible choices of "interfaces":
- USB HID
- EspruinoBLE HID
- RN42 HID
- Xbox360 ( XInput )
- ..
the "gamepad higher level helper" could be close to the draft I wrote for another subject on the forums ( http://forum.espruino.com/conversations/325589/ )
- USB HID
-
• #17
Yeah, that's a tricky one. I'd maybe just do:
exports.initialise = function(descriptor_callback, send_hid_callback) { ... }
Then you can do:
function send_hid_callback(data) { Serial.write( 0xFD, // indicates raw hid report 0x06, // bLength 0x01, // bDescriptorType - constant ( String assigned by USB ) data ); }
for the RN-42?
-
• #18
Hi there !
On the RN42 subject, some readers of this topic may found the following useful:
http://forum.espruino.com/comments/14444935/cheers ++
I had one around, (exactly this: https://www.sparkfun.com/products/12574) and tried interfacing. It's been pretty easy, I just connected pin 11 to 3.3v, pin 12 to GND, pin 13 to A2 and pin 14 to A3 and that was it.
With this code I can echo stuff written to the corresponding serial port on the pc.