• This repository has been archived on 20/Dec/2018
  • Stars
    star
    270
  • Rank 152,189 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 12 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🎮 [UNMAINTAINED] Interface for Xbox 360 game controller into Node.js

Node Xbox Controller

npm version Dependency Status devDependency Status Gitter

Interface for Xbox 360 game controller into Node.js

Lots of low level details about the controller here:

Mac OSX driver: for Lion/Snow Leopard or for Yosemite

Install

npm install xbox-controller

Usage

var XboxController = require('xbox-controller');
var xbox = new XboxController;

xbox.on('a:press', function (key) {
  console.log(key + ' press');
});

xbox.on('b:release', function (key) {
  console.log(key+' release');
});

xbox.on('lefttrigger', function(position){
  console.log('lefttrigger', position);
});

xbox.on('righttrigger', function(position){
  console.log('righttrigger', position);
});

xbox.on('left:move', function(position){
  console.log('left:move', position);
});

xbox.on('right:move', function(position){
  console.log('right:move', position);
});

xbox.on('connected', function(){
  console.log('Xbox controller connected');
});

xbox.on('not-found', function(){
  console.log('Xbox controller could not be found');
});

Also see the example.js for usage.

LEDs

Set LED pattern on controller:

xbox.setLed(0x0A);

Available LED patterns:

0x00   All off
0x01   All blinking
0x02   1 flashes, then on
0x03   2 flashes, then on
0x04   3 flashes, then on
0x05   4 flashes, then on
0x06   1 on
0x07   2 on
0x08   3 on
0x09   4 on
0x0A   Rotating (e.g. 1-2-4-3)
0x0B   Blinking*
0x0C   Slow blinking*
0x0D   Alternating (e.g. 1+4-2+3), then back to previous*

Rumble

Control left and right rumble motors:

var leftStrength = 255;
var rightStrength = 255;

xbox.rumble(leftStrength, rightStrength);

Where the strengths are between 0 and 255.

Within function

Listen for when a trigger or stick's position is within a particular range:

xbox.within('righttrigger', [50,100], function(err, data){
	console.log('rightttrigger within 50 and 100', err, data);
});

Multiple Devices

On startup, if a device is in use, it will be skipped and the next available device will be used. The serial number and path will be printed to the console for debugging.

Use the printed serial number to specifically address devices if required, see Serial Numbers below.

Serial Numbers

Each device has own serial number. On startup, the serial number of the device detected will be printed to the console.

To use a specific serial number, specify it when creating the controller:

var xbox = new XboxController('9BB004D0');

If you have a third party controller without 'controller' in the name, specify the device serial number to use that device.

Configuring a Third Party Controller

To configure a third party controller:

XboxController.configure();

Copyright

Copyright (c) 2016 Andrew Nesbitt. See LICENSE for details.

More Repositories

1

first-pr

:octocat: What was the first pull request you sent on GitHub?
JavaScript
234
star
2

hell-is-other-peoples-code

🔥
40
star
3

node-sass-example

👌 [UNMAINTAINED] Example app to show how to use node-sass
JavaScript
36
star
4

hipsternews

👨 [UNMAINTAINED] Rubymotion Hacker News reader
Ruby
35
star
5

lanyrd

📅 [UNMAINTAINED] An unofficial wrapper around the Lanyrd API
Ruby
25
star
6

ar-drone-gps

✈️ [UNMAINTAINED] Control a Nodecopter using the Flight Recorder GPS addon
JavaScript
23
star
7

bumble

[UNMAINTAINED] A ruby tumblog
JavaScript
19
star
8

package-managers

Research and documentation on package management
18
star
9

node-wii-controller

🎮 [UNMAINTAINED] Interface for Wiimote game controller into Node.js
JavaScript
17
star
10

node-ev3-robot

[UNMAINTAINED] Control your Lego Mindstorms EV3 Tanks with an xbox controller over bluetooth
JavaScript
17
star
11

libsass-rails

[DEPRECATED] An experiment in rails project using libsass instead of ruby sass with the asset pipeline.
Ruby
16
star
12

ghpm

🌵 [UNMAINTAINED] An npm mirror/proxy directly to modules on GitHub
JavaScript
16
star
13

github-plus

[UNMAINTAINED] A Google Chrome extension that adds extra features to GitHub.com
JavaScript
15
star
14

deploytracking

[UNMAINTAINED] Track deployments with capistrano
Ruby
14
star
15

spree-api-client

[UNMAINTAINED] A rubygem for interacting with the Spree API
Ruby
13
star
16

ian

[UNMAINTAINED] I.A.N. - Intelligent Artificial Nerd
JavaScript
13
star
17

buzzfeed

[UNMAINTAINED] 🐝 Buzzfeed headline generator
JavaScript
12
star
18

node-lanyrd

📅 Unofficial Lanyrd API client
JavaScript
11
star
19

ar-drone-keyboard

[UNMAINTAINED] Control your Parrot AR Drone with your keyboard
JavaScript
10
star
20

instascraper

[UNMAINTAINED] Basic, free api to instapaper
Ruby
10
star
21

base62.go

[UNMAINTAINED] An attempt at a go library to provide Base62 encoding, perfect for URL shorteners
Go
10
star
22

cardsagainsthumanity

[UNMAINTAINED] Online version of Cards Against Humanity
JavaScript
9
star
23

drone-xbox-controller

[UNMAINTAINED] Control your Parrot AR Drone with a Xbox 360 controller
CoffeeScript
9
star
24

jquery-uk

[UNMAINTAINED] jQuery UK Presentation
JavaScript
8
star
25

lightning

[UNMAINTAINED] Lightning talk timer made with RubyMotion
Ruby
8
star
26

module_import

[UNMAINTAINED] Namespace all imported modules rather than polluting the global namespace.
Ruby
7
star
27

em-shortener

[UNMAINTAINED] A url shortener written in EM
Ruby
7
star
28

feeddit

[UNMAINTAINED] An improvement to the standard RSS feed on Digg.com
Ruby
7
star
29

wansview

[UNMAINTAINED] Wansview webcam controller for direction and taking pictures
JavaScript
6
star
30

flipSource

[UNMAINTAINED] Flip your page over to view the source
JavaScript
6
star
31

hubot-nodecopter

[UNMAINTAINED] Control a Nodecopter with Hubot
CoffeeScript
6
star
32

dotfiles

My dotfiles for autotest, rubygems and git, install with http://github.com/technicalpickles/homesick
Shell
6
star
33

quadcopter-presentation

[UNMAINTAINED] An automated ignite style presentation that sends commands to a connected Parrot AR Drone via socket.io from the browser.
JavaScript
6
star
34

node-gps

[UNMAINTAINED] Read NMEA data from GPS serial devices
JavaScript
5
star
35

3D-contributions

[UNMAINTAINED] 3D print your github contributions graph
JavaScript
5
star
36

node-shortener

[UNMAINTAINED] A url shortener written in Node
JavaScript
5
star
37

giftlist

[UNMAINTAINED] List wedding gifts and reserve them.
Ruby
5
star
38

goliath-shortener

[UNMAINTAINED] A url shortener written in Goliath
Ruby
5
star
39

Nodecopter.app

[UNMAINTAINED] Nodecopter as desktop app, no terminal required!
JavaScript
4
star
40

nesbitt.io

🏡 My Homepage
HTML
3
star
41

brewery

[UNMAINTAINED] The start of a macruby app
Ruby
3
star
42

webflight-onscreen-keyboard

[UNMAINTAINED] 💻 webflight plugin to provide an onscreen-keyboard
JavaScript
3
star
43

reevoo

[UNMAINTAINED] Reevoo API wrapper
Ruby
3
star
44

qrtag

[UNMAINTAINED] Dynamic QR codes via a url, powered by sinatra.
Ruby
3
star
45

decommission

[UNMAINTAINED] Quickly discover which versions of rails all your apps are running
Ruby
3
star
46

helloworlds

[UNMAINTAINED] Hello worlds in a variety of different languages
Ruby
2
star
47

arduino-experiments

[UNMAINTAINED] Experiments with Arduino and Johnny-five
JavaScript
2
star
48

harlemshake.js

[UNMAINTAINED] Make your AR Drones do the Harlem Shake
CoffeeScript
2
star
49

ruby-cid

ruby library for parsing ipfs and multiformat cids
Ruby
2
star
50

bude

🏠 Source code for Budechalet.com
JavaScript
2
star
51

ar-drone-rest

[UNMAINTAINED] A simple rest server to control your Parrot AR Drone
CoffeeScript
2
star
52

snooze

[UNMAINTAINED] Keep your web apps awake.
Ruby
2
star
53

eventHUD

[UNMAINTAINED] A dashboard for your events
CoffeeScript
2
star
54

gbnc

[UNMAINTAINED] Great British Node Conf Website
CSS
2
star
55

hellococoa

[UNMAINTAINED] A Hello World App in Cocoa for Mac OS X
Objective-C
2
star
56

node-dancemat

[UNMAINTAINED] PS3 compatible dancemat controller into Node.js
JavaScript
2
star
57

instareader

[UNMAINTAINED] A simple, readable instapaper web interface
Ruby
2
star
58

nodecopter

[UNMAINTAINED] A Command line utility for nodecopter
JavaScript
2
star
59

hackday

[UNMAINTAINED] An app for showing and voting on hacks built during a Hackday.
Ruby
2
star
60

rack-accepts

[UNMAINTAINED] Rack middleware to reject crappy http accept headers
Ruby
2
star
61

spdy

[UNMAINTAINED] Showoff based Presentation about SPDY
1
star
62

how_much

[UNMAINTAINED] Tiny Geo-location aware house price checking web app
JavaScript
1
star
63

lrug

[UNMAINTAINED] Example RubyMotion app built for LRUG talk
Ruby
1
star
64

wwwd

[UNMAINTAINED] What would wizzbit do?
Ruby
1
star
65

ar-drone-dancer

[UNMAINTAINED]
JavaScript
1
star
66

first-django-app

[UNMAINTAINED] hello world django app
Python
1
star
67

andrew-nesbitt

[UNMAINTAINED]
JavaScript
1
star
68

sphero-mapper

[UNMAINTAINED] Hackference 2014 Sphero Demo
JavaScript
1
star
69

brightonruby

Ruby
1
star
70

whatsinaname

[UNMAINTAINED]
Ruby
1
star
71

engines

[UNMAINTAINED] Rails engines slides for Forward away day talk
Ruby
1
star
72

coolometer

[UNMAINTAINED] How cool are you?
Ruby
1
star
73

cocos2d-experiment

[UNMAINTAINED]
Objective-C
1
star
74

dragonfly_example

[UNMAINTAINED] Example image hosting/resizing app for heroku
Ruby
1
star
75

code-tennis

[UNMAINTAINED] Play tennis with other github users on a repo
Ruby
1
star
76

confkick.com

[UNMAINTAINED] The community funded conference sponsor
1
star
77

.github

1
star
78

paperdoily.co.uk

HTML
1
star
79

andrew-nesbitt.com

[UNMAINTAINED] Personal website
CoffeeScript
1
star
80

whitehat

[UNMAINTAINED] Private issues for public repos
Ruby
1
star
81

andrew

Content for GitHub profile
1
star
82

clasher

[UNMAINTAINED] Check for events on a particular day or days with no clashing events
CoffeeScript
1
star
83

formview

[UNMAINTAINED]
Ruby
1
star
84

moods

[UNMAINTAINED] Spotify app that plays music based on your mood.
1
star
85

now

[UNMAINTAINED]
Ruby
1
star
86

hello_node

[UNMAINTAINED] Hello world in node, express and coffee-script
JavaScript
1
star
87

rumbl

[UNMAINTAINED] Programming Phoenix tutorial app
Elixir
1
star
88

ipfs-http-client

Fork of https://gitlab.com/persper/gitlab/ipfs-http-client
Ruby
1
star
89

euler

[UNMAINTAINED] My solutions to Project Euler written in Ruby
Ruby
1
star