Monday, June 23, 2008

Sending Information from wiimote through sockets

Lately I have been playing around with the Wiimote, and have started to do some simple programs with it, using some of the code that had to offer.

I have just made a program that uses sockets,and connects a server with multiple clients.The clients make certain petitions to the server, in order to obtain information they desire. The information that I made available to them, was the current acceleration that the wiimote had, the pitch angle and the rolling angle. ( for now this is the only information I am interested in sending to the clients.)

Because I used part of the code, that wiiyourself had to offer, and they coded everything with the Windows api, I had to development everything exclusively for Windows. Therefore when I coded the sockets, I used winsock2.

The first thing that I wanted to do was to get the project that WiiYourself had available up and running. The exe. from their project can be downloaded from their webpage, and can be very easily tried out. Their exe. first checks to see if there is a wiimote connected. (If there is a wiimote that is connected to the computer's Bluethooth, or to an external bluethooth that is connected to the computer) If not, it will keep searching until a wiimote is finally connected.
Once it finds a connection to a wiimote, it will display on the screen a lot of information related to the wiimote, such as which buttons are being pressed, what the orientation from the remote is, the x, y and z acceleration, the pitch angle etc.

I wanted to use, this code that that the staff in WiiYourself had already coded, so the first thing that I needed to do, was download their version 1, of the project. (Available in the webpage I mentioned)

In order to compile this project it is necessary to have certain headers. The MS Driver Development Kit (DDK) is required to build (for the HID API). It's a free download, and can be obtained from:

It takes a while to download, and then it also takes a while to install, but it does work!

In the project, it is then necessary to add its 'inc/wxp' dir to the include paths, and 'lib/wxp/i386' to the library paths.

With this, one should be able to compile the project.
You can now try it out!

I have to confess, that in this part, I suffered many problems!

In my home computer, I was able to run this program without any troubles,but when I tried to install it in a computer in my school, I got the blue screen of deaTH!! I tried other computers, and all of them, once the program had found the wiimote, got the blue screen of death!!!
At first I was dazzled, I didn't know why the heck I was getting that screen, I thought for a moment that it might have to do with the ddk that I installed, maybe it wasn't a good match with the service pack that these computers had....yeah I had no ideA, what the hell???

Then I realized, that in my home computer I had another version of bluesoleil. (I am currently using Bluesoleil to connect the wiimote to the computer's bluethooth in a more effective and quick manner.

In my school, I downloaded the free Bluesoleil version, and I think that might have been the reason, I was getting the bluescreen of death. The free download version, limits the amount of information, that can be sent and recived. I am assuming that the wiimote, tried to send in more data then what was currenlty available. I believe this is the reason, because once I installed the Bluesoleil version that I had in my house, everything worked out fine. If anyone has suffered forom this before, and has a better explanation to why this was happening please let me know!


No comments: