wii

Wii provides asynchronous native bindings to the libcwiid C API.

Contributors

Building and installing

Dependencies

To run wii you need Node.js (>=v0.10.0) or io.js (>=v1.0.0), bluez, and libcwiid installed. To run unit tests you will need to have git installed and accessible from your PATH to fetch any vendor/ addons.

It is sufficient enough to rely on the system package manager to install libcwiid and bluez. Refer to your distros repository search to find the correct module names and installation procedure.

Linux (Ubuntu/Debian)

Ensure you have the dependancies installed

$ sudo apt-get install libbluetooth-dev libcwiid-dev $ sudo npm install -g node-gyp

Install wii by from npm:

$ npm install wii

A demo applicaton can be run like so:

$ node example/simple/server.js

Apple OS X/Windows via Cygwin

node-wii currently does not run on either Mac OS X or Windows machines. This is a problem with libcwiid . A future plan is to fork libcwiid and write support for at least Apple OS X.

API Example Usage

Connecting and enabling features

Raw API

var wii = require ( " wii " ) ; var wiimote = new wii . WiiMote ( ) ; wiimote . connect ( " 00:00:00:00:00 " , function ( err ) { if ( err ) { console . log ( ' Could not establish connection ' ) ; return ; } wiimote . rumble ( true ) ; wiimote . led ( 1 , true ) ; wiimote . led ( 3 , true ) ; wiimote . led ( 3 , false ) ; wiimote . ir ( true ) ; wiimote . on ( " ir " , function ( points ) { for ( var p in points ) console . log ( " Point " , p [ ' x ' ] , p [ ' y ' ] , p [ ' size ' ] ) ; } ) ; } ) ;

Methods

connect(address, callback)

disconnect()

requestStatus()

rumble(flag)

led(led, flag)

button(flag)

ir(flag)

ext(flag)

acc(flag)

Events

connect

disconnect

accelerometer

button

ir

status

nunchuk

classic

balance

motionplus

Release information

Cleaned up the project

Added nunchuk support

Added classic controller support

Added balance support

Added motion plus support

Added request status, but cwiid doesn't seem to do anything with it

Cleaned up the readme file

Disabled console debug output

Renamed project to node-wii for publishing on npmjs.org

Fixed pacakge.json to point to the node-wii.js stub instead of erronusly trying to load the binary directly

Upgraded to support node 0.10.0

Change build system to node-gyp

Change event framework from EIO to UV

Added a new example using socket.io

Changed the use of cwiid to be truely async

Some useful methods implemented

Partial examples in example directory

Getting involved

If you find this project of interest, please document all issues and fork if you feel you can provide a patch.