It's a good idea to use a gamepad that is known to work well with the BeagleBone or BeagleBone Black. Most of the low-end gamepads and joysticks work very well (because they use commonly used chipsets), and also some of the higher-end devices, like the Logitech F710 works very well and is very accurate.
Read the Joystick using BoneScript / Cloud9 / node.js:Install the node-joystick module with this command line:
Add this code to your project: // Set a deadzone of +/-3500 (out of +/-32k) and a sensitivty // of 350 to reduce signal noise in joystick axis var joystick = new (require('joystick'))(0, 3500, 350); joystick.on('button', onJoystickData); In the callback you will get data on this format: Axis event: { time: 10352486, value: -3716, number: 0, type: 'axis', id: 0 } Button event: { time: 10414941, value: 1, number: 2, type: 'button', id: 0 } |
Using the BeagleBone >