Post on 02-Jan-2016
Wii mote interfacing
The product
• It is a wireless device, using standard Bluetooth technology to communicate
• The Wii Remote uses the standard Bluetooth human interface device (HID) protocol to communicate with the host, which is directly based upon the USB HID standard (used to describe human interface devices such as the mouse and keyboard)
Wiimote Library for C#• WiimoteLib Functions by Brian Peek (
http://www.codeplex.com/WiimoteLib and http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx)
• Supports a handful of report types such as:• Buttons - Button data only• ButtonsAccel - Button and accelerometer data• IRAccel - Button, accelerometer and IR data• ButtonsExtension – Button and extension data• ExtensionAccel - Button, accelerometer and extension data• IRExtensionAccel - Button, accelerometer, extension and IR
data– The report type can be set by calling the
SetReportType method
Sample
using WiimoteLib;
private void Form1_Load(object sender, EventArgs e){ // create a new instance of the Wiimote Wiimote wm = new Wiimote(); // setup the event to handle state changes wm.WiimoteChanged += wm_WiimoteChanged; // setup the event to handle insertion/removal of extensions wm.WiimoteExtensionChanged +=
wm_WiimoteExtensionChanged; // connect to the Wiimote wm.Connect(); // set the report type to return the IR sensor and accelerometer
data (buttons always come back) wm.SetReportType(Wiimote.InputReport.IRAccel, true);}
void wm_WiimoteExtensionChanged(object sender, WiimoteExtensionChangedEventArgs args)
{ if(args.Inserted) wm.SetReportType(Wiimote.InputReport.IRExtensionAccel, true);
// return extension data else wm.SetReportType(Wiimote.InputReport.IRAccel, true); // back to original mode}
void wm_WiimoteChanged(object sender, WiimoteChangedEventArgs args)
{ // current state information WiimoteState ws = args.WiimoteState;
// write out the state of the A button Debug.WriteLine(ws.ButtonState.A);}
Other libraries
• Wii Device Library• BobcatwiiLib
Progress…
• Wii Program– Version by Sir Daniel– Detects IR coordinates
• What needs to be done– Create new code– Buy bluetooth device– Create a Sensor Bar