-
• #2
Is the idea to build a joystick with espruino or be able to talk to the hacked Joy-Con like device? Personally I think it makes more sense to hack existing controller. Some of them even use processors that can be flashed with espruino. I did a quick hack of "daydream" like controller for a device called miraprism controller. There is lots of similar available to buy.
Long time ago I have build a controller from scratch and wasnt happy about it. Mainly because cheap knob modules you can buy have small usable range of movement. If you spend more money for proper modules you might as well buy already made whole thing.
Right now I am working on web joystick app that will communicate with my espruino over Web Bluetooth. Then I can just use it from my phone.
This is the project I need the joystick for. There is few post discussing joysticks options there: bolidJs
I would be interested if anyone comes up with a solution that can talk to espruino device. -
• #3
Is the idea to build a joystick with espruino or be able to talk to the hacked Joy-Con like device?
Well I own a Nintendo Switch for a few days now and even if the little Joy-Con are cute, I would have loved to build a replica a little bit bigger and maybe with small improvements, like a special button for holding stuff behind a kart (for Mario Kart as you imagine) instead of keeping the standard button pressed for as long as you want.
Well, at the end those modifications are only a pretext to build something new with Espruino ;-)I did my own Espruino game controller a few months ago, which was basically a BLE HID keyboard with specific buttons. Here the task is a bit more complicated because it involves reverse-engineering a few things such as the pairing process but I am sure that being able to provide Espruino community with some game controllers examples will be very positive. I am a casual gamer, but I am confident that many of us would love to benefit from Espruino in the gaming area.
By the way, I really love the bolidJS project !
-
• #4
I did my own Espruino game controller a few months ago, which was basically a BLE HID keyboard with specific buttons.
I would be interested in looking into code for that if its open.
provide Espruino community with some game controllers examples will be very positive
I agree, it would be nice if there was such a device based on espruino for gaming or remote controlled cars/robots.
By the way, I really love the bolidJS project !
thanks, hopefully there will be big update after Christmas
-
• #5
I would be interested in looking into code for that if its open.
Well the code is very basic. It implements UP, DOWN, RIGHT, LEFT, BACKSPACE and ENTER keys.
At each key event, the key bufferkeys[]
is updated and sent to the host (in my case an android phone running a gameboy emulator). It works well even if I noticed a small delay between the key press and the actual response in the game. I don't know if it comes from the BLE or the emulator.var kb=require("ble_hid_keyboard"); BTN_UP=D3; BTN_DN=D24; BTN_LEFT=D2; BTN_RIGHT=D22; BTN_SEL=D4; BTN_START=D5; BTN_B=D28; BTN_A=D25; var keys=[0,0,0,0,0,0,0,0]; function onInit(){ NRF.setServices(undefined, { hid : kb.report }); setWatch("keys[2]=kb.KEY.UP;NRF.sendHIDReport(keys);", BTN_UP, {edge:"falling",repeat:true,debounce:50}); setWatch("keys[2]=0;NRF.sendHIDReport(keys);", BTN_UP, {edge:"rising",repeat:true,debounce:50}); setWatch("keys[3]=kb.KEY.DOWN;NRF.sendHIDReport(keys);", BTN_DN, {edge:"falling",repeat:true,debounce:50}); setWatch("keys[3]=0;NRF.sendHIDReport(keys);", BTN_DN, {edge:"rising",repeat:true,debounce:50}); setWatch("keys[4]=kb.KEY.LEFT;NRF.sendHIDReport(keys);", BTN_LEFT, {edge:"falling",repeat:true,debounce:50}); setWatch("keys[4]=0;NRF.sendHIDReport(keys);", BTN_LEFT, {edge:"rising",repeat:true,debounce:50}); setWatch("keys[5]=kb.KEY.RIGHT;NRF.sendHIDReport(keys);", BTN_RIGHT, {edge:"falling",repeat:true,debounce:50}); setWatch("keys[5]=0;NRF.sendHIDReport(keys);", BTN_RIGHT, {edge:"rising",repeat:true,debounce:50}); setWatch("keys[6]=kb.KEY.BACKSPACE;NRF.sendHIDReport(keys);", BTN_B, {edge:"falling",repeat:true,debounce:50}); setWatch("keys[6]=0;NRF.sendHIDReport(keys);", BTN_B, {edge:"rising",repeat:true,debounce:50}); setWatch("keys[7]=kb.KEY.ENTER;NRF.sendHIDReport(keys);", BTN_A, {edge:"falling",repeat:true,debounce:50}); setWatch("keys[7]=0;NRF.sendHIDReport(keys);", BTN_A, {edge:"rising",repeat:true,debounce:50}); }
-
• #6
Thanks. I will try this out with the we app I am working on. I added update for a joystick in the BolidJs project. I am still reading on the HID documentation. I wonder if it can do two way communication. I would like to be able to send information about the speed back to the controller. I have a gauge indicator there for speed. Its not necessary but would be cool if this works.
-
• #7
I am still reading on the HID documentation. I wonder if it can do two way communication
It is! You can get a
NRF.on('HID',...
event back - it's usually used for caps lock/etc lights but you can send other stuff that way too: http://www.espruino.com/Reference#l_NRF_HIDHad you tried just pairing a normal Bluetooth HID device (even if that was an Espruino) with the Switch? It may 'just work' without having to fully emulate the Joycon?
But I'd have thought it wouldn't be too painful to implement the Joycon's Bluetooth HID profile (which I guess you could dump if you paired it with a Linux PC?)
-
• #8
Had you tried just pairing a normal Bluetooth HID device (even if that was an Espruino) with the Switch? It may 'just work' without having to fully emulate the Joycon?
I didn't yet, I don't know if it is even possible. I'll try and let you know.
Anyone already working on this?
I see that some people already partially reverse-engineered the Joy-Con protocol (HID) over USB, I guess it would be the same protocol over Bluetooth?
https://github.com/shinyquagsire23/HID-Joy-Con-Whispering