I found a old post(http://forum.espruino.com/conversations/325589/) with code to use the Pico as a gamepad using its HID functionality and as I'm looking to build some stuff for Sim racing where it would be excelent to be able to simulate a joystick/gamepad I tried to get it to work but with no success.
If anyone can point me in a good directions or have ideas on how to integrate hardware divices in a analog way to games, I would be happy.
So you're specifically after analog inputs, rather than just buttons?
Because for sim racing and just buttons you might be fine with USB Keyboard, which is handled by http://www.espruino.com/USB ?
The gamepad module was never added to the standard Espruino module list, but you should still be able to reference it by URL:
var gamepad = require('https://raw.githubusercontent.com/stephaneAG/usbHidDescriptors/master/espruino_ble_hid_gamepad.js');
// debug easily using http://html5gamepad.com/ ;p
gamepad.sendGamepadState(0b1111111111111111, 127, 127, 127, 127);
gamepad.sendGamepadState(0b1111111111111111, -127, -127, -127, -127);
What happens if you try something like that?
I got both mouse and keyboard to work not gamepad when I tried with the code you suggested.
But will have another try and se of I can figure out what is wrong.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem