Sunday, June 08, 2008

Establishing a basic connection with the Wiimote

Been working on coding for the Wiimote using C# and have thankfully made some progress. Import the wiimote library and create an object for the wiimote

using WiimoteLib;

Now in the main function
wm.SetReportType(InputReport.IRAccel, true);
wm.SetLEDs(true, false, false, false);

This establishes the connection with the wiimote and the SetLeds tells the wiimote to show the first of four lights on the controller.
x = wm.WiimoteState.IRState.IRSensors[0].Position.X.ToString();
y = wm.WiimoteState.IRState.IRSensors[0].Position.Y.ToString();

This saves the coordinates in our strings x and y. You can take a printout or do whatever you want with these values now, still not sure what rate the wiimote is streaming the data at though.

1 comment:

Anonymous said...

I am trying to duplicate your modified code in my WiimoteLib so I can monitor my x and y coordinates in a data collection program. I am familiar with the C# language, but the class I took was back in highschool.. Could you tell me exactly how I would go about creating this object for the wiimote? Thanks