Skip to content

Instantly share code, notes, and snippets.

@hakant
Last active September 6, 2016 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hakant/7ee37ee00fccfbf487d2c6d3328f13dd to your computer and use it in GitHub Desktop.
Save hakant/7ee37ee00fccfbf487d2c6d3328f13dd to your computer and use it in GitHub Desktop.
pseudo node.js code that reads inputs from playstation buzz controllers
var HID = require('node-hid');
var bitwise = require('bitwise');
var socket = require('socket.io-client')('https://frill-crafter.hyperdev.space');
device.on("data", function(data) {
// Interpret data buffer and figure out which buttons on which controllers are being pressed
// ... Visit https://github.com/hakant/NfieldQuizGame to see the actual code
// Then emit the following message to the socket.io server running on hyperdev (for each controller)
socket.emit('button-clicked', `{ "ControllerId": ${controllerId}, "ButtonId": ${buttonId} }`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment