Java library for Wii peripherals

The majority of the information used to generate this library comes from the Wii-brew website, and specifically these three pages:


Currently my library is based around the bluecove interface for accessing the bluetooth hardware:


In order for bluecove to compile under eclipse for 64-bit systems requires the following flag passed to the JVM:

<jvmarg value="-d32"/>

The standard bluecove library does not work with 64-bit Matlab, in order to get this to work requires downloading the snapshot #63:


In order to get the library to work with Matlab requires a few adjustments.  To begin, exit Matlab if it is open.  Then open Matlab's static class path:

<MATLABPATH>/toolbox/local/classpath.txt

Add the path to the bluecove library bluecove-2.1.1-SNAPSHOT.jar to the end of classpath.txt. The path to the Processing files is most likely something like:

<BLUECOVEPATH>/Libraries/bluecove-2.1.1-SNAPSHOT.jar

Now restart Matlab and add dynamic paths to the directories containing the java class code.  These must contain the full path to the class path including the root folder containing the package:

javaaddpath({ ...
   '/Users/bingjeff/Projects/WiiBalance/bin/', ...
   '/Users/bingjeff/Projects/WiiBalance/bin/wiibalance', ...
   '/Users/bingjeff/Projects/WiiBalance/bin/wiibalance/devices' ...
   '/Users/bingjeff/Projects/WiiBalance/bin/wiibalance/gui' ...
   '/Users/bingjeff/Projects/WiiBalance/bin/wiibalance/server'})

To test if the bluecove library is reachable with Matlab try the following commands:

import javax.bluetooth.*
o = LocalDevice.getLocalDevice();


A very basic script for reading data from Matlab using the Wii Library is then done by running the following example m-file:

% Create DataHandler object
oDataHand = wiibalance.gui.DataHandler();

% Initialize DataHandler
oDataHand.init();

% Get data from DataHandler
while(oDataHand.isRunning)
    oDataHand.update();
end

% Close connection to bluetooth
oDataHand.stop();

On Windows Vista/7 systems additional steps may be required. These include downloading a specially compiled library bluecove.dll and setting a system property.
  • Download the bluecove.dll
  • Save it in the appropriate system directory
  • In java code set the system property to widcomm:
    • System.setProperty("bluecove.stack", "widcomm");
ċ
wbb_test.m
(1k)
Jeff Bingham,
Sep 8, 2011, 12:12 PM
ċ
wii_java_setup.m
(1k)
Jeff Bingham,
Sep 8, 2011, 12:12 PM
ċ
wiibalance_20110908.zip
(78k)
Jeff Bingham,
Sep 8, 2011, 12:12 PM
Comments