Wiiremote – Visual Studio.net Connection (English)

Posted by : Bora Ciner | 19 Mayıs 2009 Salı | Published in

The Wii Remote, sometimes unofficially nicknamed "Wiimote", is the primary controller for Nintendo's Wii console. A main feature of the Wii Remote is its motion sensing capability, which allows the user to interact with and manipulate items on screen via movement and pointing through the use of accelerometer and optical sensor technology. Another feature is its expandability through the use of attachments.

Firstly we’re installing bluesoleil software from here ,then we press 1 and 2 buttons of wii remote at the same time, when we see the leds’ being blinking we connect to Wiiremote from bluesoleil program. It should see the device as an HID ( Human interface device) .

Now, We’re connected to Wiiremote from our pc via bluetooth connection.

Secondly, We’re configuring VS.Net with doing 3 steps.

1-) We select Project->Add Referance from our VS.Net 2008 project, in the Browse tab we select WiimoteLib.dll and add this .dll file to our project as an referance.

2-) In the begining of Form1.cs file we add this line in order to import the wiiremote library.

using WiimoteLib;

3-)The upper level of the public Form1() we add this line to create wiimote object

Wiimote wiimote1 = new Wiimote();

4-)Now we read the angular values of the wiiremote, put a button in the form and add these codes in that button.

wiimote1.Connect();
wiimote1.SetReportType(InputReport.IRAccel, true);
float xAccel = wiimote1.WiimoteState.AccelState.Values.X;
//acceleration value of the x axis
float yAccel = wiimote1.WiimoteState.AccelState.Values.Y;//y ekseninin ivmesel değeri
float zAccel = wiimote1.WiimoteState.AccelState.Values.Z;

now we have the values which we took from the wiiremote device.Finally , we want to see these on a label.

put a label on the form and append this line in the previous button.

label1.Text = xAccel.ToString();

 

When we press the button, it reads the values and display them on the label.

(0) Comments