BrianPeek.com

A Compendium of Random Uselessness
in Search

New Wiimote Goodness

My latest article has been posted at MSDN's Coding4Fun site.  This article explains how to create a Wiimote Controlled Car using my Managed Library for Nintendo's Wiimote.  At the end of the article, you will have a remote controlled car that can be driven with a standard Nintendo Wiimote.

Also note that my original Wiimote library and article have been updated with some new features including x64 support, a potential fix for those with incompatible Bluetooth adapters/stacks, and a Microsoft Robotics Studio service.

As always, comments and questions welcome.  Enjoy!

Published Jun 12 2007, 04:30 AM by Brian Peek
Filed under: , ,

Comments

 

Cheng said:

Hello Brain:

Thank you very much for updating the code. I hope that you will add multiple wiimote support to the code soon :)

BTW, I have a question about the follow code in your example:

if(args.Inserted)

wm.SetReportType(Wiimote.InputReport.IRExtensionAccel, true);

else

wm.SetReportType(Wiimote.InputReport.IRAccel, true);

This code is included in the wm_OnWiimoteExtensionChanged() function. My question is, once the user inserted the Nunchuk, you change the report type. What's the difference between these two types and why is it import to switch between them?

Thank you!

June 20, 2007 11:01 PM
 

Brian Peek said:

Cheng,

When the extension is inserted, we want to get the extension data back in addition to the IR and accelerometer.  This switches the Wiimote report type to send data for the IR, the extension and the accelerometers.

Brian

June 20, 2007 11:13 PM
 

tom said:

Hello Brian,

I've downloaded the lib and it works beautifully... and I'd like to wrap it in a Max external (www.cycling74.com).

So I must ask, the code is released under what license?

Thanks!

tom.

June 22, 2007 7:11 PM
 

Brian Peek said:

Hi Tom,

The code is not released under any specific license.  It's free to use as you please.  A credit to me somewhere would be nice, though not required.  ;)

Enjoy!

Brian

June 22, 2007 7:19 PM
 

Cheng said:

Hi Brian:

I encountered a weird problem when I use your lib. Sometimes, when I terminate the program, I receive the following error message:

Invoke or BeginInvoke cannot be called on a control until the window handle has been created.  at this line:

BeginInvoke((MethodInvoker)delegate(){clbButtons.SetItemChecked(0, ws.ButtonState.A);});

This problem doesn't occur very often, but I wonder if it is possible to eliminate it.

Thank you!!

July 11, 2007 4:42 PM
 

Brian Peek said:

Hi Cheng,

The test app isn't the most beautifully-coded thing in the universe.  :)

I'm guessing the Wiimote thread isn't shutting down before the main window is tearing itself down, so BeginInvoke is attempting to do its thing even though the main window is closing.

You can try setting a flag in the Form_Closing event and not fire BeginInvoke calls after that's set.  Or don't use BeginInvoke.

Sorry, I don't have a real good answer for you.  The test app is strictly meant to be a test, not used in a production environment...

July 11, 2007 4:50 PM
 

Cheng said:

Hi Brian:

Thanks for your suggestion!

July 15, 2007 12:45 AM
 

Eric said:

Hi Brian:

I am very interested in your program! It's really so cool....

But I have a fundamental question....I don't know how to solve it!

When I use the wiimote to draw a line: X, Y and Z dimension.

How to let the computer recognition which line do you draw?

I know it's simple question, but I'm very confused!!!

( or....where can I find some codes about my questions? )

Thank you very much :)

August 31, 2007 6:17 AM
 

Brian Peek said:

Eric,

Not sure I understand the question and what you're trying to do.  Can you explain further?  You may want to post in the forum section to more easily allow discussion.

August 31, 2007 12:04 PM

Leave a Comment

(required)  
(optional)
(required)  
Add

About Brian Peek

Brian is a Microsoft C# MVP who has been actively developing in .NET since its early betas in 2000, and who has been developing solutions using Microsoft technologies and platforms for even longer. Along with .NET, Brian is particularly skilled in the languages of C, C++ and assembly language for a variety of CPUs. He is also well-versed in a wide variety of technologies including web development, document imaging, GIS, graphics, game development, and hardware interfacing. Brian has a strong background in developing applications for the health-care industry, as well as developing solutions for portable devices, such as tablet PCs and PDAs. Additionally, Brian has co-authored the book "Debugging ASP.NET" published by New Riders, and is currently co-authoring a book titled "10 Coding4Fun Projects with .NET for Programmers, Hobbyists, and Game Developers" to be published by O'Reilly in late 2008. Brian also writes for MSDN's Coding4Fun website, contributing articles on a monthly basis.
Copyright (C) 2008 Brian Peek
Powered by Community Server (Commercial Edition), by Telligent Systems