Connect to a Bluetooth Serial Device with Xamarin.Android

I have been exploring the Xamarin tools recently and decided to try my hand at connecting some Bluetooth hardware to Android for a project that will be released soon. I have learned quite a bit about Bluetooth on Android and decided to write up a short description on how to connect to a Bluetooth serial device via RFCOMM/SPP.

First, grab an instance of the default BluetoothAdapter on the Android device and determine if it is enabled:

BluetoothAdapter adapter = BluetoothAdapter.DefaultAdapter;
if(adapter == null)
    throw new Exception("No Bluetooth adapter found.");

    throw new Exception("Bluetooth adapter is not enabled.");

Next, get an instance of the BluetoothDevice representing the physical device you’re connecting to. You can get a list of currently paired devices using the adapter’s BondedDevices collection. I use some simple LINQ to find the device I’m looking for:

BluetoothDevice device = (from bd in adapter.BondedDevices …
Read More

Visual Studio Live! – Chicago 2014

I will be presenting 2 sessions and speaking on the closing panel at Visual Studio Live! in Chicago this May 5-8.  The conference is a full 4 day event and there’s still time to register and save $200 if you register before 4/16/14!  For this event, I’ll be presenting:

TH10 Performance and Diagnostics Hub in Visual Studio 2013
Thursday, May 8, 2014
Time: 11:00am – 12:15pm
Level: Intermediate

Visual Studio 2013 has introduced a new Performance and Diagnostics hub which encompasses a variety of new and old tools to profile your Windows Store applications. In this session, we will take a detailed look at all of the tools that the Performance and Diagnostics Hub has to offer with both XAML and HTML/JavaScript Windows Store apps.

TH20 Writing Asynchronous Code Using .NET 4.5 and C# 5.0
Thursday, May 8, 2014
Time: 3:00pm – 4:15pm
Level: Introductory

A variety of new features were added to the .NET 4.5 Framework, including support for easily writing asynchronous code. …

Read More

Visual Studio Live! – Las Vegas 2014

imageI will be presenting 3 sessions at Visual Studio Live! in Las Vegas this March 10-14.  The conference is a full 5 day event and there’s still time to register and save $500 if you register before 1/22/14!  For this event, I’ll be presenting:

LT20 Controlling Hardware using Windows 8.1
Tuesday, March 11, 2014
Time: 4:15pm – 5:30pm
Level: Introductory

Windows 8.1 allows developers to communicate with a variety of devices through several interfaces. In this session, we will look at how to talk to hardware connected via USB and Bluetooth, as well as some of the new APIs which allow Windows 8.1 to talk to Point of Sale (POS) devices, scanners, and even 3D printers using real examples with real hardware!

LT27 Performance and Diagnostics Hub in Visual Studio 2013
Wednesday, March 12, 2014
Time: 1:15pm – 2:30pm
Level: Intermediate

Visual Studio 2013 has introduced a new Performance and Diagnostics hub which encompasses a variety of new and old tools to profile your Windows …

Read More

Visual Studio Live! - Chicago 2013

imageI will be presenting a session at Visual Studio Live! in Chicago this May 13-17 at the Hilton Chicago.  The conference is a full 5 day event and there’s still time to register and save $400!

W01 Building Your First Windows Phone 8 Application
Wednesday, May 15, 2013
Time: 9:15 am - 10:30 am
Level: Introductory

Expand your mobile horizons with Windows Phone 8!  Developing applications for the phone is extremely similar to building a XAML application for the desktop.  In this session, I will demonstrate the fundamentals of Windows Phone development while building a very simple application which covers all of the important points of the new platforms architecture, including the developer tools and device emulator and touch input.

W13 Windows Store Application Contracts and Extensibility
Wednesday, May 15, 2013
Time: 3:00 pm – 4:15 pm
Level: Intermediate

In this session, we will explore these contracts and how …

Read More

Async Goodness at Tech Valley .NET User Group

imageI’ll be giving a session to the Tech Valley .NET Users Group (TVUG) Tuesday, March 13th at 6:30pm on the new async goodness that exists in .NET 4.5 and C# 5.0, as well as the Visual Studio Async CTP which can be used with Visual Studio 2010.  Here's the description:

Title: Writing Asynchronous Code Using .NET 4.5 and C# 5.0
Where: Tyler Technologies, Latham, NY
When: Tuesday, March 13th, 2012, 6:30-8:30PM

A variety of new features were added to the .NET 4.5 Framework, including support for easily writing asynchronous code. This session will introduce the concepts of asynchronous programming, .NET Tasks, how to ensure your UI remains responsive, and how to do all of this properly in your own applications using the new async and await keywords. If you’re looking for ways to provide a better, smoother experience for your users, don’t miss this session!

You will learn:

  • Learn about the pros/cons of asynchronous code
  • Learn how to write and use asynchronous code in …
Read More

Kinect at Tech Valley .NET User Group

imageFor my fellow Capital District folks, I’ll be giving a session to the Tech Valley .NET Users Group (TVUG) Tuesday, December 13th at 6:30pm on everything that is Kinect and the Kinect for Windows SDK  Here are the details….

Where: Tyler Technologies, Latham, NY
When: Tuesday, December 13th, 2011, 6:30-8:30PM

Join us as Brian Peek demonstrates the basics of using the Kinect for Windows SDK including:  how Kinect works, installing and setting up the Kinect sensor, setting up the development environment, reading camera, depth and skeleton data, understanding what depth data is and how it works, skeletal tracking and working with the Kinect microphone array to record audio and use speech recognition.

Hope to see you all there!

Read More

Visual Studio Live! - Orlando 2011

imageI will be speaking at Visual Studio Live! in Orlando this December 5-9.  The conference is a full 5 day event and there’s still time to register!  The two sessions I’m presenting are:

TH2 - XNA Games for Windows Phone 7
Date: Thursday, December 8, 2011
Time: 8:00 AM – 9:15 AM 
Level: Introductory to Intermediate

You have Silverlight on Windows Phone 7 under control, but what about XNA? If you're looking to create a more advanced game with better performance than Silverlight, XNA is the platform for you. In this session, developers will learn how to build an XNA game targeted for Windows Phone 7. The basics of the platform will be demonstrated while building a simple Space Invaders-type game that would be Marketplace acceptable. Specifically, this session will cover how to deal with user input, play sound effects and music, display animated 2D graphics, and how to create a game that's ready to be sold on the Marketplace.

TH12 - Multi-touch Madness! …

Read More

Kinect for Windows SDK + XNA

imageI have seen a few people talk about using the Kinect for Windows SDK with XNA lately, and many of those projects aren't using the SDK how it's intended to be used from a framework such as this.

When I had a hand in working on the managed SDK, I made a point that the API should allow for both an "eventing" model, and a polling model.  In the land of WPF and WinForms, an eventing model makes perfect sense.  In these frameworks, the SDK is intended to be used thusly:

private Nui.Runtime _kinect = Nui.Runtime.Kinects[0];

private void Window_Loaded(object sender, RoutedEventArgs e)
    _kinect.DepthFrameReady += DepthFrameReady;
    _kinect.SkeletonFrameReady += SkeletonFrameReady;

void DepthFrameReady(object sender, ImageFrameReadyEventArgs e)
    // do something with the depth frame

void SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
    // do something with the skeleton frame

But, in the land of XNA, where all of your code is …

Read More

Kinect for Windows SDK is here!


Hooray!  I can finally talk about this!  As I've alluded to previously, I had a hand (one of many) in the managed portion of the SDK and what was originally shown at MIX. Since then the SDK has changed a bit but it's finally ready to go!

The Kinect for Windows SDK is now available for download on the Microsoft Research site.  We have also launched several samples over at Coding4Fun that you can begin using immediately:

Coding4Fun Kinect Toolkit

You definitely want to download this one when you get started.  This toolkit contains a variety of extension methods and controls to make using the Kinect for Windows SDK even easier to use.  Some of my code appears in this one.  Smile

Kinect Mouse Cursor

This sample is entirely mine.  Kinect Mouse Cursor is a demo application that uses the Kinect for Windows SDK and its skeletal tracking features to allow a user to use their hands to control the Windows mouse cursor.  Use your right hand to move the …

Read More

MJPEG Decoder

209653324My latest article and library is now live on the brand new Coding4Fun site, now on Channel 9, and over at CodePlex.  This project allows you to very easily decode a MJPEG (Motion JPEG) stream from a network camera (or any other source) into a consumable type for WinForms, WPF, Silverlight, XNA and Windows Phone 7 (both Silverlight and XNA).

The MJPEG Decoder library started life as a project for the t-shirt cannon built for the MIX10 keynote.  The original plan was to have an IP camera attached to the robot for a real-time video stream from the bot's perspective, but the feature wound up being cut for time, and due to some issues rendering the video on the very early Windows Phone 7 tools.  The library has been sitting around a while, has gone through several rewrites and now supports almost every platform I can think of.  With the new Coding4Fun up and running, it was time to polish it off and get it posted.

Take a look at the article, download the binaries and …

Read More

Visual Studio Live! - Las Vegas 2011

VSLLV11_Speak_VLSPK24I will be speaking at Visual Studio Live! in Las Vegas this April 18-22.  The conference this year is being held at the Rio All Suites Hotel and Casino (to quote Penn Jillette directly) and is a full 5 day event.  The two sessions I’m presenting are:

TH1 - Multi-touch Madness!
Date: Thursday, April 21, 2011
Time: 8:00 AM - 9:15 AM
Level: Introductory to Intermediate

Multi-touch technology is popping up everywhere, most recently in Windows 7 and various .NET technologies. Windows 7 has been designed from the ground-up with multi-touch in mind, and the newest versions of WPF and Silverlight are multi-touch capable as well. In this session I will take you through the 4 biggest areas of Microsoft multi-touch technology: Windows 7, WPF 4, Silverlight, and Surface, including the forthcoming Surface Toolkit for Windows Touch. You will learn how to make your applications multi-touch aware and capable using each of these platforms, how to handle gestures and …

Read More

NuGet-enabled WiimoteLib and ThinkGearNET

With the official release of NuGet and the NuGet gallery, I decided to try it all out by uploading the current versions of WiimoteLib and ThinkGearNET to the gallery.  The process was pretty smooth, but I learned a little bit along the way which I thought I’d share.

So what’s NuGet?
From their own page:  NuGet (formerly known as NuPack) is a free, open source developer focused package management system for the .NET platform intent on simplifying the process of incorporating third party libraries into a .NET application during development.

In short, this means you can right-click and add a reference to a third party library without having to download it yourself, extract it, locate it manually on your drive, deal with dependencies, etc.  All of this is handled automatically, as is finding and integrating new versions of those libraries with your projects.

NuGet as a User
If you want to use NuGet to download packages, you’ll first need to install the …

Read More

Visual Studio Live! Orlando 2010

Update: Slides and source for my sessions are posted over on my Events page.  Have a look!  Thanks to everyone that came to my sessions!  Comments and critiques are welcome.

imageI have been selected to speak at the Visual Studio Live! conference in Orlando.  In addition to presenting two sessions at the conference, I’m also coordinating a special event on Tuesday night which we’re calling Devopalozza.  I have created and will host a team Jeopardy! style game-show which will pit three teams of speakers and attendees against each other for fabulous prizes.  I previously created the hardware and software for the Visual Studio Live Redmond conference, which turned into an article on Coding4Fun for those that might want to create a game-show at home or the office.

The two sessions I’m presenting are:

M15 What's New in Visual Studio 2010 Debugging
Date: Monday, November 15, 2010 
Time:  3:00 PM – 4:15 PM
Level: Intermediate

Visual …

Read More

TweeVo v1.1 Released!

A new version of TweeVo is finally available.  This version allows the program to work once again now that Twitter has switched over to a mandatory OAuth/xAuth authentication scheme.  Chris Miller deserves all the credit for this one for handling the implementation of the new security scheme with some sample code from Shannon Whitley.  You can find downloads over on the original TweeVo page.  Give it a try and let me know if you run into any issues making it go.  Enjoy!

Read More

ThinkGearNET 1.1

imageI released version 1.1 of ThinkGearNET over at CodePlex last week.  ThinkGearNET is a library that allows developers to easily use the Neurosky MindSet device with .NET.  This version now matches Neurosky’s latest SDK and supports eye blink detection.  Nothing else has changed.  If anyone has used a prior version of the library, please give the new version a try and let me know if you have any problems.  Thanks!

Read More

VSLive! Redmond 2010

n190107439474_2070I have been selected to speak at this year’s VSLive! conference on the Microsoft Campus in Redmond.  I’m very excited about this conference for a couple of reasons.  First, it’s on campus, which will allow me to get together with my Coding4Fun/Channel 9  friends to do some planning.  Secondly, VSLive! attendees are also allowed to spend some of their own cash at the Microsoft store.  And finally, in addition to presenting two sessions at the conference, I’m also coordinating a special event on Wednesday night which we’re calling Devopalozza.  I am creating a team Jeopardy! style game-show which will pit Microsoft Speakers against VSLive! Speakers against VSLive! Attendees.  I’m currently creating both hardware and software to drive the game, which will later turn into an article on Coding4Fun for those that might want to create a game-show at home or the office.  And, I’ll even be hosting the show at the event.

The two sessions I’m presenting …

Read More

The Coding4Fun Show – Ep 5 with Josh Blake

The fifth episode of my Coding4Fun Show, is now up on Channel 9.  In this episode of the Coding4Fun Show, I chat with Josh Blake about Natural User Interfaces and Multitouch programming with .NET.  Josh has written a multitouch PowerPoint replacement called NaturalShow, which was demonstrated during his NUI session at MIX10. Watch and learn a bit about how this application was created as well as how you can write multitouch applications with WPF.  And for even more multitouch programming goodness and more on NaturalShow, Josh is currently working on a book titled Multitouch on Windows, which can be purchased and read while he's writing it!

    You should see the video below if you have Silverlight installed, otherwise head over to the episode on Channel 9 to watch and download in a variety of formats for offline viewing.

    The Coding4Fun Show: Natural User Interfaces with Josh Blake

    A big thanks to Josh for the interview!

    Read More

    WiimoteLib Future

    image I’ve been working on a version 2.0 of WiimoteLib which reorganizes the library quite a bit to clean up the codebase.  It’s not quite ready for release, and I don’t have an ETA currently, but I wanted to note some of the changes and get some feedback as I finish things up.

    • I will be including a VS2010 solution for the project in addition to the original VS2008 solution
    • I’m hoping to have support for both sound and the WiiMotion Plus extension completed
    • Support for the Taiko Drum and DJ Hero turntable (testers welcome for the DJ Hero turntable)
    • Extensions have been broken out into separate classes so their code is self contained:
      • image
      • All extensions inherit from ExtensionController
      • All state objects for extensions implement the IExtensionState interface
      • Here’s an example of the new Nunchuk class.  As you can see, everything related to the Nunchuk is located in this class:
      • using System; …
    Read More

    Ask the Experts at MIX10

    Mix10_SeeYou_blk_240 As I posted earlier, I’ll be attending MIX10 this year, and I will be taking part in the Ask the Experts panel on Monday evening at 5pm.  I will be at the C# table since I’m a C# MVP, so stop by and start a discussion!  Experts in a variety of subjects will be on hand so even if C# isn’t your thing, surely one of the many other topics will be.  And even if you’re an antisocial shut-in like I am, beer will be served and there will be 2 Zune HDs given away to attendees of the event.  So really, there’s something for everyone.  Hope to see you there!

    Read More

    ThinkGearNET Library

    mindset I have written and posted a new library that allows .NET developers to easily connect to and use the Neurosky MindSet headset from any .NET application.  You can find the source code and a binary of the library at CodePlex.  Usage is very simple and may seem familiar to those that have used my .NET Wiimote LIbrary; set a reference to the library and you can connect to a headset as follows:

    private ThinkGearWrapper _thinkGearWrapper = new ThinkGearWrapper();
    private void Connect()
        _thinkGearWrapper = new ThinkGearWrapper();
        // setup the event
        _thinkGearWrapper.ThinkGearChanged += _thinkGearWrapper_ThinkGearChanged;
        // connect to the device on the specified COM port at 57600 baud
        _thinkGearWrapper.Connect("COM4", 57600, true);
    void _thinkGearWrapper_ThinkGearChanged(object sender, ThinkGearChangedEventArgs e)
        // write out one of the many properties
        Debug.WriteLine("Attention: " + e.ThinkGearState.Attention;

    The …

    Read More

    MindBlaster Article Posted

    mindblaster My latest Coding4Fun article on the creation of my game MindBlaster is now available!  This is a game I wrote using XNA Game Studio 3.1 that combines a Nintendo Wiimote and a Neurosky MindSet headset to create a game you play entirely with your head.  If you were at PDC09 and stopped by the Coding4Fun area you may have seen it, or, if you’ll be at MIX10, please stop by the Coding4Fun area and see this and 3 or 4 more even better projects by Coding4Fun authors.


    Read More

    MIX10, Coding4Fun Show, and You!

    c9logo I will be at MIX10 showing off MindBlaster once again.  More on that shortly…

    But, more importantly, are you going to MIX10?  Do you have a fun or interesting project you’d like to talk about?  Let me know!  I’m looking for people to interview for the Coding4Fun Show.  I’m always interested in talking to people who want to chat about what they’re working on, even if it’s just a hobby or something that’s incomplete.  That’s what Coding4Fun is all about!  So please, if you’ll be at the MIX, have a few minutes to chat, and want to be the envy of your friends, contact me!

    Read More


    10/28/13: TweeVo 1.4 Released!

    This should fix up things with the latest Twitter API changes…again…

    11/19/12: TweeVo 1.3 Released!

    This should fix up things with the latest Twitter API changes…

    12/8/10: TweeVo 1.2 Released!

    TweeVo 1.2 has been released which now works with some modifications Twitter made to OAuth around 11/30. A huge thanks to Chris Miller and for doing the heavy lifting on this one and implementing the fix. The binary and source code are updated and can be found at the links below. Let me know if you run into any trouble with this new version.

    10/14/10: TweeVo 1.1 Released!

    TweeVo 1.1 has been released which now works with Twitter’s mandatory OAuth authentication scheme. A huge thanks to Chris Miller, Conrad, and Mark Zaugg for testing the changes. The binary and source code are updated and can be found at the links below. Let me know if you run into any trouble with this new version.

    TweeVo, my latest article and application, is now up at …

    Read More

    Multi-touch Madness Slides and Code


    Thanks to everyone who attended my TVUG session last night!  I have uploaded the slides and code for this session which can be downloaded here.  Note that you’ll need Visual Studio 2010 Beta 2 for most of the samples, and you will need to have the Surface Workstation SDK SP1 installed if you wish to run that sample.

    Comments and questions are welcome, as always.  Thanks!

    Read More

    Coding4Fun at PDC Video Recap

    c9logo It looks like all of the Coding4Fun videos pertaining to PDC09 have been posted along with most (all?) of the Channel 9 Live videos.  For those interested in the Coding4Fun recap vids, have a look…

    Get Microsoft Silverlight
    Channel 9 Live at PDC09: Coding4Fun
    Clint Rutkas, Brian Peek and Tim Higgins with Scott Hanselman
    Recorded Live, November 19th 2009 at 11:00AM (PST)

    Get Microsoft Silverlight
    Coding4Fun at PDC 2009
    With our lab coats in hand, we brought Drinktendr, Mind Blaster, Laser graffiti, Wi-Fi Warthogs and finally Goblin XNA (augmented reality)!

    Read More

    PDC09, Coding4Fun, and Mind Blaster

    Another PDC is over and I’m happily relaxing before work starts again on Monday.  Lots of announcements, free laptops for attendees (not me, sadly), and plenty of time spent in our Coding4Fun area with my project.  We even had the opportunity to take part in a live broadcast on Channel 9!  The recording for that show should be available shortly.

    We had 5 fantastic projects in the Coding4Fun area this year:

    Drinktendr by Clint Rutkas
    Laser Graffiti by Jeremiah Morrill
    Goblin XNA by Ohan Oda
    Wi-Fi Warthogs by Tim Higgins

    And what was my big project this year?  A fun little game titled Mind Blaster, a space shoot ‘em up game played entirely with your head!

    Mind Blaster

    How does one do that? Well…

    This past July I found a brain-wave sensing headset from Neurosky called the MindSet.  They are now shipping headsets at $200 each and provide a free …

    Read More

    PDC 2009

    Before and AfterPDC 2009, starting November 17th, is almost upon us and I’ll be heading out to the conference once again with my Coding4Fun/Channel 9 playmates.  Anyone else heading out to the big show?

    We won’t be doing a Coding4Fun session like we did last year, but I will have another fun project for people to check out in the Coding4Fun area.  I can’t give out details until after the show begins, but you can probably guess there is a Wiimote in the mix somewhere.  And some spiffy new hardware.  And maybe some XNA.  Look for the details here after the show, and an article with full source code shortly thereafter.

    We also have 4 or 5 other developers with their latest and greatest projects, all of which are nothing short of incredible and put mine to shame.  I will likely be doing a compendium Coding4Fun Show with all of this year’s project authors so those not in attendance can see their incredible work.

    I will also be hosting a table during lunch on Monday, …

    Read More

    Tech Valley Code Camp 2009

    Update 11/1/09: Session schedule is posted!  20 sessions to choose from.

    tvcc_09The Tech Valley Code Camp is almost here!  This year’s camp will be taking place on Saturday, November 7th, 2009 at SUNY Albany from 9am-3pm and is absolutely, 100% free for everyone to attend.  So far we have 18 sessions scheduled for everything from LINQ to Silverlight to iPhone development to Ruby on Rails.  I encourage all of our local developers to attend this event, and furthermore, present something to the group!  This code camp is platform agnostic, so practically software development topic would be great to present.

    I’ll be presenting two sessions on Silverlight which I recently presented at VSLive Orlando 2009:

    Getting Started with Silverlight
    Room: CC 367
    Time: 1:00pm

    Microsoft Silverlight allows developers and designers to build rich cross-browser and cross-platform applications for the Web using the same tools and technologies that are familiar to .NET …

    Read More

    Akismet Spam Filter for Community Server 2008.5

    spamReg It appears the fantastic Waegis spam filtering site used to block blog comment spam has been down for over a month as the author tries to find hosting and figure things out.  Sadly, that leaves a lot of Community Server users with no decent comment spam blocking solution since Waegis was perhaps the only spam blocking engine which actually provided a working plug-in for Community Server 2008.5.

    So, as the community around Community Server gets more and more fragmented, and as Telligent leaves its non-paying, hobby/personal use customers in the dust, I decided to write a simple Akismet spam filter for Community Server 2008.5.  Please note that this works ONLY with Community Server 2008.5.  Any previous version will not recognize it.

    This wound up being pretty simple because the Waegis filter, written by Keyvan Nayyeri, had its source code included, and Joel Thoms had written an Akismet library for .NET, available on CodePlex.

    So, putting the chocolate in the peanut …

    Read More

    VSLive! Orlando 2009 Sessions Posted

    vslive Thanks to everyone who came out to my two VSLive sessions today.  You can find the slide decks and full source code posted in my download section.  Please note that in order to save some bandwidth, I didn’t include the 125MB video file I used in my examples, but you can download that separately here.  Just unzip and copy to the Media and GPUAcceleration sample directories and build the project.

    I welcome any and all questions, and especially comments/critiques.  As a speaker, I rarely, if ever, receive any formalized feedback from the session organizers, so I’d love to hear what those in attendance thought of my sessions.  Good or bad, please send it along!  Thanks!

    Read More

    VSLive! Orlando

    vslive Anyone out there heading to VSLive! Orlando this week?  I will be giving two introductory sessions on Silverlight as listed below:

    Getting Started with Silverlight
    Tuesday, October 6, 10:30am

    Microsoft Silverlight allows developers and designers to build rich cross-browser and cross-platform applications for the Web using the same tools and technologies that are familiar to .NET developers.  This session will cover the basics of Silverlight, including basic XAML, the tools that can be used to create Silverlight applications, the controls available in the Silverlight framework, and pros and cons of Silverlight vs. other web technologies, all while building a few very simple applications demonstrating the power of the framework.

    Silverlight Controls and Animations
    Tuesday, October 6, 12:00pm

    The Microsoft Silverlight framework contains an assortment of pre-built controls that can be used directly by your applications.  Developers can also create their own …

    Read More

    The Coding4Fun Show – Ep 3 with Rick Barraza

    c9logo The third episode of my Coding4Fun Show, live from Las Vegas, is now up on Channel 9.  In this episode I interview Rick Barraza of Cynergy Systems, who has put together several very unique applications and accompanying tutorials demonstrating advanced rendering techniques using Silverlight 3.  During the show, we discuss Silverlight 3, UX design, and the three demos he has created showing off advanced rendering techniques.  For more on how these amazing demos were made, check out his (currently) three part series at his blog:

    You should see the video below if you have Silverlight installed, otherwise head over to the episode on Channel 9 to watch and download in a variety of formats for offline viewing.

    The Coding4Fun Show: Advanced Rendering with Silverlight, Rick Barraza


    A big thanks to Rick for taking a few minutes out of his vacation …

    Read More

    Anyone in Vegas for C4F Show Interview?

    logo Is there anyone in or around the Las Vegas area between September 7th and September 12th that would like to be my guest for an episode of the Coding4Fun Show?  I’ll be in the area for the week and would love to do an in-person show with anyone doing a cool project with Microsoft technologies.  If you’re interested, please contact me so we can set something up.  Maybe you’ll even get a free lunch out of it.  :)  Thanks!

    Read More

    WiimoteLib 1.8 Beta 1 Posted

    image I have posted a new version of WiimoteLib as a beta for people to play around with the Wii MotionPlus accessory.  Please note that this is not a stable release and should only be used if you wish to mess around with the MotionPlus.  Also note that only C# source code is included in this release as it is not a final build.  Here’s the change log:


    • Taiko Drum Master's TaTaCon drum controller supported (Dean Herbert)
    • Bare-bones Wii MotionPlus support (, testing by Tyler Tolley)
    • WiimoteTest UI changed to add MotionPlus data
      • Please note that the current version is VERY flakey and may not work at all for you.
      • Pair your Wiimote, plug in your MotionPlus, call InitializeMotionPlus()
      • Extensions plugged into the MotionPlus will give wacky results...not supported...yet!
      • Internal changes to perhaps fix some threading issues

    So remember, it’s a beta, it may not work for you, and the data you’ll get back from the accessory is …

    Read More

    Facebook .NET Programmers Group XNA Session Posted

    NET PROGRAMMERS2bcropSmall2 The recordings for the session I gave on XNA Game Studio 3.0 and the XNA Framework to the Facebook .NET Programmers Group have now been posted.  In this session, I give an overview of XNA Game Studio 3.0 and the XNA Framework while building a simple Space Invaders clone named Alien Attack.  This game is gone into even greater detail with more features in chapter 1 of our Coding4Fun book.

    You can find a quick, low-res, streaming version below, or you can download and play the recording at a higher resolution in Microsoft Office Live Meeting.  I had a great time presenting the topic and hope to speak to the group again in the future!

    Meeting #13 - Coding4Fun: Designing a Video Game using XNA Game Studio 3.0 from Muneeb on Vimeo.

    Read More

    Status of Wii MotionPlus Support for WiimoteLib

    Update: See this post for a beta release

    wii-motionplus Ok, I get about 10 emails a day on this, so I figure a status update is in order.

    The Wii MotionPlus extension for the Wiimote was released last week.  Since then, I and others have been working to figure out how the device works.  Unfortunately, it does NOT work as every other extension controller has worked up until this point, mostly due to the fact that the Wii MotionPlus accessory has an expansion port of its own so all of the other extension controllers can plug into it.

    In the past few days, some progress has been made thanks to the folks over at, although functionality is nowhere near complete.  For example, it’s currently impossible to have the Wiimote notify you when the Wii MotionPlus is inserted into the bottom of the Wiimote, like all of the other extension controllers do.

    I have been working with the information at and am trying to get things working reliably with my library so that …

    Read More

    The Coding4Fun Show – Ep 1 with Andy Beaulieu

    logo The very first episode of my new Coding4Fun Show is now up on Channel 9.  This is a show I plan on doing monthly, interviewing developers creating fun and interesting projects, and showcasing what they’re doing.

    In this first episode, I interview Andy Beaulieu and we discuss his Physics Helper for Silverlight, Blend, and Farseer.  You’ll learn a bit about how he made the library, and how you can use it in your own applications for some pretty cool effects.  You should see the video below if you have Silverlight installed, otherwise head over to the episode on Channel 9 to watch and download in a variety of formats for offline viewing.

    The Coding4Fun Show: Physics Helper for Silverlight by Andy Beaulieu

    Have a look and let me know what you think.  It’s my first time trying this out, so I’d love to hear your feedback.  Thanks!

    Read More

    Facebook .NET Programmers Group Session on XNA 3.0

    image I will be giving a session on Tuesday, June 2nd at 6pm EST to the Facebook .NET Programmers group on XNA 3.0.  This is an online session and everyone is welcome to attend.

    Topic: Building a Video Game with XNA Game Studio 3.0
    Abstract: This session will demonstrate how to build a very simple 2D game (a Space Invaders clone) using XNA Game Studio 3.0. Attendees will learn how to effectively use the content pipeline, import 2D sprites into XNA, manage input from the keyboard, mouse, Xbox 360 controller and Zune, manage game state, and debug the resulting game. The sample code will be built on a PC and run on the PC, Xbox 360, and Zune platforms when complete.
    Date: June 2nd, 2009
    Time: 6PM Eastern | 10PM GMT/UTC - Get local event time in your city:
    Add to Outlook:
    RSVP and Event Details:
    Live Meeting Link to join meeting:

    I’ll …

    Read More

    Install the Surface SDK SP1 Workstation Edition on x64


    Update 11/20/09: The Surface SDK is now available to everyone at the new Surface website!  The instructions below should continue to work just fine…let me know if they don’t.

    Update 10/29/09: It appears that the version of the SDK available from the Microsoft Partner site comes as a straight .exe file.  To extract this back into the MSI file to follow the instructions below, execute the following command:

    "Microsoft Surface SDK 1.0 SP1, Workstation Edition.exe" /extract c:\surface

    This should spit out a MSI file to the c:\surface directory and you can continue on with the instructions below.  Thanks to Tim Hurst for the info!

    The Surface SDK SP1 Workstation Edition was released this week and while it will install (but is still unsupported) on Windows 7, it will not install on a 64-bit machine.  The installer has changed a bit, so my previous instructions will not work with this installer, but I have managed to get the new package to install …

    Read More

    Install the Surface SDK on Windows 7 and/or x64


    Update: Running Surface SDK SP1?  See my other post on how to install it on a 64-bit machine...

    The Microsoft Surface SDK was given out to some folks at PDC 2008.  I know the SDK is not out to the masses yet, however one of the questions/requests posted most frequently in the Surface forums is the ability to install the SDK on a 64-bit machine, and/or on Windows 7.  I’ve put together a quick guide that will show how to accomplish this.  But be warned…by doing this you are throwing away support from Microsoft.  This is an entirely unsupported setup and the Microsoft Surface folks won’t be able to help you.  So, if official support is important to you, this guide isn’t for you.  With that said, let’s continue…

    Please note that you will still need to have Visual Studio 2008 Express or greater installed, and you will need to have the XNA 2.0 Framework runtime installed.

    To perform the actions in this guide you will …

    Read More

    Contest: Win a Free Copy of Our Coding4Fun Book!

    image I’ve decided to setup a simple contest to give away a free copy of our book, Coding4Fun: 10 .NET Programming Projects for Wiimote, YouTube, World of Warcraft, and More.  Entering is simple.  Post a reply to this forum post located at:

    And to make it a bit more interesting, here’s a topic for your post:  How have you coded for fun?  Write up a couple sentences on any fun project you’ve tackled at some point in your spare time.  I won’t disqualify you if you don’t, but I’d love to hear about your projects, and I’m sure others would too.

    Make sure you are registered on this site with a valid email address and are logged into your account so I have a way to get in touch with you if you are the winner.  No, this isn’t some elaborate scheme to harvest email addresses…

    Entries must be received by Saturday, February 28th at 11:59pm EST.  One person will be randomly selected and contacted shortly thereafter …

    Read More

    Brian and Dan on .NET Rocks!

    image This week, Dan Fernandez and I had the opportunity to be on the .NET Rocks! show with Richard and Carl.  We spent some time chatting about our Coding4Fun book (available at fine booksellers everywhere!) and several extremely interesting projects Richard and Carl have created in the past, including an anthromoporphic remote-controlled car, and a parrot who enjoys extremely right-wing politics.  I think you’ll just need to listen to the show to understand what those are about…

    Read More

    Virtual Earth 3D Beta Documentation Released

    image If you’ve followed any of my Virtual Earth 3D projects, you know that the managed API has been undocumented and unsupported for a while.  All the work that has been done so far has been possible due to a few VE3D team members posting information on their blogs and through reverse engineering using tools like Reflector.

    Well, half of the problem has been solved:  The VE3D team has now released beta documentation for the VE3D GlobeControl !  As their blog post states, it’s still beta and not officially supported, but it’s definitely a great a start.

    Now to see what assumptions I made in my projects that are incorrect…

    Read More

    WiimoteLib v1.7 Released

    image I have just put up the latest version of WiimoteLib at CodePlex.  The changes for this release are:


    • Writing registers is now properly waiting for the Wiimote to reply before continuing...this removes all of the Thread.Sleep() calls and should *greatly* improve performance when setting LEDs and rumble (Serial Nightmare &
    • Guitar Hero: World Tour Guitar and Drums now properly recognized and used (, tested by Tyler Tolley and Mauro Milazzo)
    • Guitar whammy bar is now a 5-bit value instead of 4 (
    • Position of 4 IRs now properly reported in Basic reporting mode (Dan Carter)
    • Found1/2 now properly reported in MSRS (reported by akka243)
    • MSRS project updated to Microsoft Robotics Developer Studio 2008

    Please give this new version a try and let me know how it works for you, especially if you have one of the newly supported controllers.  And, as always, what features/bugs would you like to see added/fixed?  Please …

    Read More

    Hanselminutes Podcast

    image At the very last minute before Scott left for Africa, Dan Fernandez and I were able to do a quick episode of Hanselminutes to promote our book.  Have a listen to learn a bit more about our book, the projects it contains, how they were developed, and some issues we ran into when trying to use some technologies in a way they weren’t intended to be used.  Head over to the main site to stream the show in your browser or download in a variety of other formats.

    Read More

    Coding4Fun Book News and Preview

    9780596520748_catI received my first copy of the book on Friday afternoon and it looks great!  It is now also listed as “In Stock” on Amazon.  Additionally, there is now a Google Preview of the book If you’d like to see a preview of the book, you can do so by clicking the Google Preview link below, or navigating directly to the Google Book Search page for this book.

    We have also been busy updating the book’s main site,, with source code, color images, project links, etc.  It’s not complete, but we should have it wrapped up in the next few days.

    I can’t think of a better holiday gift for the geek in your family than this, but, I may be a bit biased…

    Read More

    Head Banger Is Now Available on Xbox LIVE Community Games

    xboxboxart Several friends and I work together to write “indie” video games under the brand Ganksoft EntertainmentYou may recall that for Maker Faire 2007, we created a very simple rhythm-based music game (think Rock Band or Dance Dance Revolution) using XNA called Head Banger.

    With Microsoft’s official release of Xbox LIVE Community Games with the New Xbox Experience, we decided to blow the dust off of Head Banger, add a couple songs, integrate it bit more with Community Games and XNA 3.0 and release it.  It is now available for purchase for 200 Microsoft Points (or, as with all Arcade and Community games, there’s a free trial) straight from the Community Games section of the Games Marketplace on your Xbox 360.  It will be listed under New Releases for a little while, otherwise you can go to All Games and then the letter H to find it.  Additionally, you can view the official Marketplace page on the new web-based Xbox LIVE Marketplace site.

    Please give the trial a go and …

    Read More

    Animated Musical Holiday Lights at TVUG

    image I’ll be presenting a session on building your own holiday musical light show using Phidget boards and .NET at this month’s Tech Valley User Group.  I’ve previously written an article about this topic on the Coding4Fun site, and there will be a full chapter on this in our upcoming “Coding4Fun: 10 .NET Programming Projects for Wiimote, YouTube, World of Warcraft, and More” book.  Here are the session details…

    Abstract: This month, learn how to build an animated light show set to music, much like the famous holiday light show videos you may have seen on YouTube.  This session will cover how to build the hardware, how to build the software, and how to combine them to create a synchronized musical show for your home.
    When: Tuesday November 18th, 2008 - 6:30-9PM
    Where: VersaTrans Solutions, Latham, NY

    Hope to see you at the session!

    Read More

    WiiEarthVR Article and Source Code Posted

    I previously talked about my WiiEarthVR project shown at PDC project, and now I have posted the article for the application up at the Coding4Fun site.  Full source code is available.  You’ll need some hardware to make this go, namely a Wiimote, Nunchuk, Wii Fit Balance Board and a pair of Vuzix VR920 glasses, but the hardware can be toggled on or off depending on your own setup.  The VR920 glasses are pretty cool in that they also work with a variety of FPS games on your PC with a custom driver they include.

    The article will, among other things, teach you how to use Virtual Earth 3D from a managed host (i.e. a WinForms app, not a web page), how to talk to the Wiimote, Nunchuk and Wii Fit Balance Board, how to retrieve the head tracking data from the VR920 glasses from .NET, and how to draw stereoscopic 3D images to the VR920 glasses from .NET.  Quite a bit packed in there…

    Anyway, have a read and, as always, questions and comments are welcome.

    Read More

    WiimoteLib v1.6 Released

    image A new version of my managed Wiimote library for .NET has been released.  You can find version 1.6 up at CodePlex now.  The changes are as follows:


    • Added "center of gravity" calculation to the Wii Fit Balance Board (thanks to Steven Battersby)
    • Structs are now marked [Serializable] (suggested by Caio)
    • Battery property is now a float containing the calculated percentage of battery remaining
    • BatteryRaw is the byte value that used to be stored in the Battery property
    • WiimoteTest app now reads extensions properly when inserted at startup
    • Exposed HID device path in new HIDDevicePath property on Wiimote object
    • Changed the time delay on writes to 50ms from 100ms...this should improve responsiveness of setting LEDs and rumble

    I feel like I’m running out of things to implement and bugs to fix.  I know that’s not true.  So, I want to hear from the people using my library…

    What features/bugs do you want to see …

    Read More

    TL39: Coding4Fun: Windows Presentation Foundation Animation, YouTube, iTunes, Twitter, and Nintendo's Wiimote

    image Well, PDC2008 is over.  I had a lot of fun, met a ton of interesting and fun people, and learned about a lot of exciting new technologies.  I hope to make it back out there next year.

    Our PDC2008 session video has been posted up at Channel 9 along with the PowerPoint slide deck.  In this session you will learn about four of our current projects:  WiiEarthVR by myself, InnerTube by Dan Fernandez, TwitterVote by Clint Rutkas and BabySmash by Scott Hanselman.

    If you’d like to check out the video, you can watch it “live” or download the deck and video in various formats with the following links:

    Source code for all projects will be available soon and I’ll provide an update when it’s available.  WiiEarthVR will also have its own Coding4Fun article within a week or two.  InnerTube and TwitterVote are also featured in depth in our new book, “Coding4Fun: 10 …

    Read More

    WiiEarthVR at PDC

    Update 1/20/09: Here’s a vid from Channel9 showing the WiiEarthVR project:


    Time to talk a little bit about my PDC demo…

    About a year ago, I wrote an application to control Virtual Earth 3D with the Wiimote named WiiEarth and a corresponding Coding4Fun articleon how it was done.  Since that time VE3D has been updated several times and code changes have broken my application.  Since their API is undocumented and unsupported, it was bound to happen.

    For PDC this year, I decided to write a new version of WiiEarth, now named WiiEarthVR, using the Wiimote and some additional hardware, namely the Wii Fit Balance Board and a pair of Vuzix VR920 glasses.  Using the Balance Board, the user can shift their center of gravity (i.e. lean) and control the VE3D environment as if they were on a hovering glider.

    Wii Fit Balance Board VR920

    The VR920 glasses contain sensors to allow head tracking in 3 degrees of freedom.  A very simple API provides a way to determine the yaw, pitch and …

    Read More


    pdc Anyone heading out to PDC2008 this year?  I will be in attendance with (hopefully!) a new Wiimote project and perhaps a few old ones as well.  More details on that when the project is a tiny bit further.  We will also be giving away a free chapter of our new book “Coding4Fun: 10 .NET Programming Projects for Wiimote, YouTube, World of Warcraft, and More” to lucky PDC attendees at the O'Reilly booth.

    I will also be co-presenting a lunch session at PDC:

    Title: Coding4Fun: Windows Presentation Foundation Animation, YouTube, iTunes, Twitter, and Nintendo's Wiimote
    Date/Time: Tuesday, October 28th, 12:45pm-1:30pm
    Speakers: Dan Fernandez, Scott Hanselman, Brian Peek, Clint Rutkas
    Room: 403AB
    Abstract: Spend time with Coding4Fun authors as they walk through some DIY Development projects: TwitterVote, Wiimote, InnerTube, and BabySmash.

    You can add this session to your agenda by visiting the PDC site and searching for “Coding4Fun”.

    If anyone will be …

    Read More

    A Few New WiimoteLib Applications

    I’ve received information on a few spiffy Wiimote projects using my Managed Wiimote Library in the last couple weeks that everyone should check out…

    Wiimote Tracking System Using 3 Wiimotes by Nikolai

    This project uses 2 Wiimotes as cameras and a 3rd covered in IR LEDs to create a tracking and gesture recognition system.  Check out the video below.

    Wiirtual.Earth - A WPF Virtual Earth 3D Experiment featuring the Nintendo Wiimote by Michael Koester

    A pretty spiffy WPF UI integrating Virtual Earth 3D and the Wiimote.  Source code and more information available at the site linked above.


    Great projects!

    Read More

    VSLive NY Sessions Posted

    Thanks to everyone that attended my VSLive NY session.  I hope it was informative.  I have posted the slide-decks and source code for both of my sessions so you can tinker with the projects on your own.

    Questions and comments welcome, as always.  Thanks!

    Read More

    Coding4Fun Book News

    Now that we have finished writing the book, we finally have an official title and chapter listing.  Someday we may even have a cover.

    The title has morphed into Coding4Fun: 10 .NET Programming Projects for Wiimote, YouTube, World of Warcraft, and More and the final chapter listing (not necessarily in this order) is:

    • Alien Attack: Create a 2D clone of Space Invaders with XNA for the PC, Xbox 360, and Zune
    • LEGO Soldier: Create an action game using Popfly with a custom-built virtual LEGO character
    • World of Warcraft RSS Feed Reader: Use WoW's customizable interface to have feeds pop up while you're gaming
    • InnerTube: Download YouTube videos automatically and convert them to a file format for off-line viewing
    • PeerCast: Stream video files from any PC
    • TwitterVote: Create custom online polls on Twitter
    • WHSMail: Build a website with ASP.NET for Windows Home Server that lets you view the messages stored on a computer with Outlook
    • "Wiimote" …
    Read More

    SQL Server 2008, Visual Studio 2008 SP1 and Visual Studio 2008 Express

    I ran into a bit of weirdness yesterday when trying to install SQL Server 2008.  I have Visual Studio 2008 installed as well as a couple of the Visual Studio 2008 Express products (for testing solutions for the Coding4Fun site and the upcoming book).  I installed Visual Studio 2008 SP1 and all went as planned.  After looking at the Help –> About screens, Visual Studio and all of the Express products showed the proper version tag:  9.030729.1 SP1.  So I figured all the products were updated and good to go.

    Next I tried to install SQL Server 2008 and got an error stating Rule “Previous releases of Microsoft Visual Studio 2008” failed.  I re-installed SP1 figuring something had gone wrong, but no dice.  After digging through the SQL Server 2008 install logs I realized what was happening.  The installer was using the HKLM\SOFTWARE\Microsoft\DevDiv\XXX\Servicing\9.0\SP keys to determine if SP1 had been installed and the registry settings were set …

    Read More

    Wiimote Smoothboard

    I was contacted by Boon Jin Goh recently about his super awesome Wiimote Smoothboard application.  Boon Jin took Johnny Lee’s original Wiimote Whiteboard app and added a ton of functionality.  What was a proof of concept or tech demo is now a fully functional electronic whiteboard capable of being used in a real environment.  Here’s a video showing functionality from the 0.1 version of his app, which has had several updates since.  Definitely give it a try if you’re looking for a very capable electronic whiteboard.  Great job!

    Also note that both Johnny Lee and Boon Jin have contributed to our upcoming “Coding4Fun: 10 .NET Programming Projects for Wiimote, YouTube, World of Warcraft, and More” book (yes, the name changed again) with a chapter dedicated to the Wiimote Whiteboard.  This chapter will teach you how to build Johnny’s original whiteboard with the Smoothboard’s spiffy smoothing algorithm added in.

    Read More

    WiimoteLib and BSOD – Part 2

    Well, after a few survey responses and posts to my forum, it appears that everyone experiencing the BSOD issue with WiimoteLib is running the BlueSoleil stack.  I was also pointed to the following links on with others having the problem and apparently BlueSoleil is aware of the issue.

    So, I guess the only solution now is to wait for BlueSoleil to issue a patch and fix the problem on their end.  If/when I get any news on this (or if someone notifies me if I miss it), I’ll be sure to post the resolution here and update the WiimoteLib docs.

    Read More

    WiimoteLib and BSOD

    I’ve gotten a few emails of late with people getting BSODs when using WiimoteLib.  It appears most, if not everyone, experiencing this problem is using BlueSoleil.  That said, I’m still unsure what is happening, when it started happening, or what the resolution is.  Therefore, I have put together a short survey that I’m hoping anyone experiencing the issue will take the time to fill out that might help me determine what the root cause is.

    I’m looking for answers from people who are specifically having an issue where using WiimoteLib or an application using WiimoteLib is causing their computer to spontaneously BSOD and/or restart.  If that’s not you, please do not fill out the survey.

    To take the survey, please click here.  Thanks!

    Read More

    Windows Mobile Devices and Power States

    I’ve been doing some Windows Mobile development with the .NET Compact Framework recently and ran into a scenario where I needed the device to be in “full power” mode at all times with the back-light on.  The device is constantly powered, so battery life is not a concern.

    The obvious choice is to go into the Brightness and Power control panels and turn off the appropriate settings, but I learned that there is a way to handle this at an application level so the behavior only occurs while the application is running.

    Power State

    An application can force a specific power state using the SetPowerRequirement method, and release that state using the ReleasePowerRequirement method.  Using P/Invoke, these methods look like the following:

       1: public enum CEDevicePowerState
       2: {
       3:     D0 = 0,    // Full On
       4:     D1,        // Low On
       5:     D2,        // Standby
       6:     D3,        // Sleep
       7:     D4,        // Off …
    Read More

    VSLive! New York

    I have been selected to present two sessions at VSLive! New York this September.  Here are the abstracts:

    Title: Creating a Simple 2D Game Using XNA Game Studio to Run on a PC, Xbox 360 or Microsoft Zune

    Date/Time: Wednesday, September 10th at 3:15pm

    Description: This session will demonstrate how to build a very simple 2D game engine and game using the latest version of XNA Game Studio. Attendees will learn how to effectively use the content pipeline, import 2D sprites into XNA, manage input from the keyboard, mouse, Xbox 360 controller and Zune, manage game state, and debug the resulting game. The sample code will be built on a PC and run on the PC, Xbox 360, and Zune platforms when complete.

    Title: Interfacing External Hardware Using Managed Code

    Date/Time: Wednesday, September 10th at 4:45pm

    Description: While developers write code to build software every day, not often are they exposed to code that drives and interfaces hardware. This session will attempt to …

    Read More

    WiimoteLib v1.5.2 Released

    Sorry for all of the previous confusion.  Version 1.5.2 is now up at CodePlex.  This release now has the Wii Fit Balance Board working for everyone who has tried it.  Please let me know if you have any issues with it.  The changes:


    • Ok, Balance Board support is really fixed this time (thanks to Manuel Schroeder, Eduard Kujit and Alex Wilkinson for testing)
    • LED checkboxes are properly set on the WiimoteTest tabs


    Read More

    WiimoteLib v1.5.1 Released

    UPDATE 2: Sorry, but I've removed this release from CodePlex.  It's just too buggy (though it continues to work just fine for me).  Look for version 1.5.2 very soon...

    UPDATE:  It appears some people are still having issues with this build as well due to some Balance Boards being a bit finicky in their response times.  Stay tuned for build 1.5.2 soon…

    Oops.  Apparently the one new thing in version 1.5, Balance Board support, was actually broken.  I have just put version 1.5.1 up at CodePlex which fixes the Balance Board operation.  Sorry about that…

    Read More

    WiimoteLib v1.5 Released

    Wii-Balance-Board-1I’m really cranking out the releases these days.  Today I have released WiimoteLib v1.5 at CodePlex.  The big news is that the Wii Fit Balance Board is now supported.  The balance board is simply a very heavy piece of plastic with 4 weight sensors located at the corners.  The library reads those individual sensors to determine how much weight is applied to each sensor, and the total weight applied to the entire board.  You can use it as an impromptu (and very expensive) scale.

    Comments and bugs welcome…

    Read More

    WiimoteLib v1.4 Released

    In an effort to put out more frequent builds with fewer changes, I’ve released WiimoteLib v1.4 to CodePlex.  This release contains the single most requested feature:  multiple Wiimote support.  I’m very interested to hear bug reports and suggestions on this release, so please do let me know how it works for you.  The original Coding4Fun article has also been updated with some details on how to use multiple Wiimotes, as has the WiimoteTest application included with the distribution.


    • Multiple Wiimotes supported!
    • Slight change to ExtensionType enum for better extension detection
    • Decided I didn’t like the dependency on System.Drawing for the 2D point so am now using my own Point structs.  Sorry…
    • WiimoteTest app updated to show multiple Wiimotes working

    Read More

    WiimoteLib v1.3 Released

    Time for another WiimoteLib release!  You'll find the new version in the usual place at CodePlex.  What's new you ask?  Why, check out this list:

    • All projects updated to Visual Studio 2008 format
    • SetReportType contains an overload taking a new IRSensitivity parameter which will set the IR camera sensitivity when using an IR report type
    • Created new WiimoteException type which is now thrown by the library
    • Moved InputReport enum to namespace level
    • Events now using the generic EventHandler class instead of custom delegates
    • Refactored the state structures to use Point/PointF and my own Point3/Point3F
    • Refactored IR sensors to be an array
    • Added support for the Guitar Hero controller (tested by Matthias Shapiro, Evan Jacovier)
    • Test app will run without Wiimote connected (Andrea Leganza)
    • ReadData now returns the proper amount of data for requests of more than 16 bytes (reported by David Hawley)
    • Test application updated with above changes
    • Lots of breaking changes, but the survey …
    Read More

    Newsweek & The Wiimote

    The Nintendo Wiimote is getting some very mainstream attention lately.  I was interviewed several weeks ago by Christopher Flavelle from Newsweek magazine for a story on developers using the Wiimote for uses other than playing games with their Wii console.  The article should be in the May 19th issue of the International Edition of Newsweek and can also be read online at  Have a read...

    Read More

    Pure Pwnage & Rock Band

    Ever wanted to get a perfect score in Rock Band without really trying?  Mark Single and the folks over at Pure Pwnage wanted to do the same for one of their episodes and wound up using my Light Sequencer from the Animated Holiday Lights Coding4Fun article I wrote to sequence the hardest song in Rock Band, Green Grass and High Tides.  Using the sequencer, a Phidget Interface Kit and some specially modded guitars, they succeeded in getting a 5 star rating at 99% accuracy to achieve the payoff for the sketch.

    Check out the original episode, and the "behind the scenes" documentary on how they did it.  Great work, guys!

    Read More


    Where have I been?

    Sadly, nowhere good.

    My father passed away extremely unexpectedly on March 4, 2008 and life has been hectic and chaotic ever since.  I'm finally back into some sort of routine, so it's time to update here and explain what's going on outside of the unpleasantness.

    First off, I've been contracted to co-author a book for O'Reilly (tentatively) titled Coding4Fun with Dan Fernandez from Microsoft.  The book will be a compendium of 10 (give or take) projects that, as the title suggests, combine fun and coding.  I'll update as we go through the process.

    Secondly, I'll be presenting a session titled Introduction to Microsoft Robotics Studio with Lego NXT at the Tech Valley Code Camp this Saturday, April 19th.  If you're in the area, as always, stop by.  It should be a fun and informative day.

    And finally, I will be back to work on some Wiimote goodness soon.  I was right in the middle of Guitar Hero controller support when the above …

    Read More

    Sandcastle and API Documentation

    I’ve received a few emails recently on how I created the API documentation for my Wiimote library so I thought I’d answer here with a brief tutorial.

    The answer, in case you didn’t read the post subject, is Sandcastle. Sandcastle is a tool developed by Microsoft which builds MSDN-style help files by using reflection and XML comments from the source code of a project. Out of the box, Sandcastle is command line driven and kind of a pain to deal with, so I highly recommend the very easy to use Sandcastle Help File Builder (SHFB) application also hosted on CodePlex. This front-end provides a simple UI for setting options and building your help file in just a few minutes. The rest of this post assumed you have both Sandcastle and Sancastle Help File Builder installed.

    Building documentation is easy. First, add XML documentation comments directly to your source code. You can do this by typing 3 forward slashes in Visual Studio above your …

    Read More

    WiimoteLib Survey Results

    Once again, a bit thank you to all of you who took the time to respond.  I was amazed to receive 100 responses as quickly as I did.  So here are the results and a few comments.

    1. What type of release schedule would you prefer?


    Response Percent

    Response Count

    Frequent, small updates



    Infrequent, large updates (what I have been doing so far)




    2. I broke backward compatibility between version 1.1 and 1.2. I'm looking to do it again by cleaning up various things such as:

    • Moving anything with an X/Y coordinate to a Point struct
    • Since there are now 4 IR points all with the same properties (X, Y, MidX, etc.), I'd like to turn an IR itself into a struct, thereby having 4 IR structs in the IRState struct instead of the mish-mash of properties
    • And anything else I haven't thought of or mentioned here...

    How important is backward compatibility to you?

    Backward compatibility is for chumps...clean it up!


    I'm indifferent


    Read More

    Tech Valley .NET Users Group Session

    UPDATE: This event has been rescheduled to Tuesday, February 19 at 6:30pm due to the weather.

    For those of you in the Capital District region of NY like myself, I'll be giving a session on how to interface external hardware using .NET at the Tech Valley .NET User Group on Tuesday, February 12 at 6:30pm.  Here's my poorly written blurb on the subject:

    While developers write code to build software every day, not often are they exposed to code that drives and interfaces hardware. This session will attempt to bridge that gap and show how .NET can be used to effectively interface several hardware devices, including an RFID reader and tags, Phidget control boards with a variety of sensors, and a servo controller. Finally, the Nintendo Wiimote will be introduced along with my .NET Wiimote Library, demonstrating how to connect to a USB or Bluetooth HID device and use it from .NET, with examples showing what the Wiimote itself is capable of.

    If you're in the area, please stop by and …

    Read More

    WiimoteLib Survey

    Update:  Wow!  In just over a week I reached Survey Monkey’s limit of 100 responses for the survey.  I’ll be posting results soon.  Thanks to everyone who took the time to give me their feedback!

    For those of you that use my Managed Wiimote Library (and if you’re not, why aren’t you?), I’ve put together a very short, 3 question survey to gather some opinions on how to move forward with upcoming releases.  Please take the 30 seconds to click responses to the 3 multiple choice questions and let me know how you’d like to see the library evolve.  Thanks!

    Click here to take the survey!

    Read More

    Yet Even More .NET-based Wiimote Applications

    In the past couple of weeks, several very interesting projects using my Managed Library for Nintendo's Wiimote have appeared.

    First off, Johnny Chung Lee has created some amazing and unique user interface demos with the library which can be found at his site.  Here are a few videos showing off what he's done:


    Wiimote Whiteboard


    Head Tracking Display


    Cynergy Labs has used the library in conjunction with WPF and some of Johnny's ideas to create a Minority Report-style interface with some Microsoft Surface-style effects:


    Incredible stuff.  I'd also like to toot my own horn and state that, at the time of this writing, my Wiimote library is the #1 most downloaded project at CodePlex.  I wish I could take credit for that, but I'm certain these talented folks and their amazing work with the library are the reason for that.

    As always, if anyone out there is using the library, please contact me so I can add you to the master list.

    Read More

    Animated Musical Holiday Light Show - Version 2.0

    I finished this a bit later than I wanted to, but a brand new version of my Light Sequencer application and article is now available at Coding4Fun.  You may recall my previous article on creating a musical light show for the holidays.  If not, here's the video showing the output:

    New Features for 2.0

    • MIDI support
      • Load a MIDI file and a sequence will be automatically created based on the data contained in the file.  You can automatically create your own show with barely any effort at all!
    • Playlists
      • Load up several sequences and have them play in order to create a multi-song show!
    • More accurate timing
      • The timing algorithm used in the last version was very worked, but it wasn't perfect.  The new version uses a method which gives millisecond precision timing
    • Cut/Copy/Paste
      • One can now cut/copy/paste cells on the grid...makes it easy to repeat chunks of sequences without having to tap out the rhythm by hand over and over again
    • Edit existing …
    Read More

    x64 Development with .NET

    Earlier this year I made the switch to a 64-bit operating system - Vista Ultimate x64 to be exact.  For the most part, this process has been relatively painless, but there have been a few hiccups along the way (x64 compatible drivers, mainly, but that's not the point of this discussion).

    In the world of x64 development, there have been a few struggling points that I thought I'd outline here.  This list will likely grow, so expect future posts on the matter.

    In the wonderful world of .NET development, applications and assemblies can be compiled to target various platforms.  By default, applications and assemblies are compiled as Any CPU in Visual Studio.  In this scenario, the CLR will load the assembly as whatever the default target is for the machine it is being executed on.  For example, when running an executable on an x64 machine, it will be run as a 64-bit process.

    Visual Studio also provides for 3 specific platform targets:  x86, x64 and Itanium …

    Read More

    Possessed PC Pranks for Halloween

    It's time for more Halloween article fun at Coding4Fun.  This year I developed two applications based on movies to scare your friends.  One displays the "cursed video" from The Ring at 50% transparency against the victim's display, while the other possesses Notepad to type "All work and no play makes Jack a dull boy" over and over again as in The Shining.

    Source and executables are provided.  Prank you friends and co-workers again this year!

    Read More

    Coding4Fun Article Ideas

    If you visit my site, you're likely here because of an article I wrote on Microsoft's Coding4Fun site.  Or perhaps someone doesn't like you and punished you with a link to my blog.  Assuming the former, I am continuing to write articles on topics that are fun and/or interesting for me, but I wonder what the readers find fun and/or interesting.  So, with that in mind, do you have ideas for a future article?

    If you have any ideas, I'd love to hear about them!  Please feel free to leave ideas as a comment on this article, a post in this general forum thread (easier for discussion), or contact me directly.  Coding4Fun is a Microsoft site that is geared toward development in .NET using the free Visual Studio Express products, so please keep that in mind when offering suggestions.

    I look forward to hearing what you readers would like to learn about.


    Read More

    Wiimote Library Update

    Finally!  I have updated my Wiimote library with quite a few bug fixes and a few new features.  Here are the important links:

    Starting with this version (v1.2), the library is licensed under the Ms-PL.  This will likely change nothing for 99% of you, but be sure to read through the license before redistributing your applications compiled against this new version.

    The new version also includes a CHM help file for the entire API.  For now, the C4F article will remain the source for the basics, and the CHM will remain up-to-date with each release of the API itself.  Hopefully that will be able to provide some more detailed information than the base article, though the API itself isn't very complex.

    And finally, here's a list of things that changed since v1.1 .  Note that this list may not be 100% complete as I was a bit lax in keeping my changes noted.

    • Moved to CodePlex! ( …

    Read More

    WiiEarth -- Wiimote Interface for Virtual Earth

    Long time no blog.

    My latest article is up at Coding4Fun.  This time I created a Wiimote interface for Virtual Earth 3D.  You can now drive around Virtual Earth like you're playing a first-person shooter on the Wii.  I think it's fun.  Hopefully you will too.  Here is a video of the demo in motion:

    As always, full source code provided.  Give it a try and let me know what you think!

    Additionally, I'll have a new version of my Wiimote library up in the next day or three.  Check back for more details...

    Read More

    Outlook Webmail Add-in for Windows Home Server

    My latest article is posted to Coding4Fun.  This time, I wrote an add-in for Windows Home Server that allows one to view their email stored in Outlook via the web.  Perhaps I'm the only one, but I have 6 or 7 email accounts all of which POP into Outlook.  Hardly any of them support IMAP or have a webmail interface.  When I'm away from home and want to check my messages, either I have to remote desktop into my home machine and use Outlook that way, or I need to remember to shut down outlook, and then check all accounts separately.  With this add-in, I can now view my Outlook messages via a web browser.

    I'm doing something a little different with this article by offering the source code and binaries via CodePlex.  My hope is that you folks out there might find a use for this and decide to extend it.  Hopefully CodePlex will make that process easier.

    Check out the article and, as always, comments and questions welcome!

    Read More

    Head Banger

    XNAiconBack in May, I posted about my involvement in Maker Faire 2007.  For one of my projects, myself and several friends, collectively known as Ganksoft Entertainment, created a game from scratch using the Microsoft XNA Framework and Game Studio Express called Head Banger.  It's a rhythm-based music game in the vein of Dance Dance Revolution (DDR) and Guitar Hero.  If you are a fan of either game, or the genre in general, you'll likely enjoy what we've created.  I have posted the game up to our website in both Windows and Xbox 360 flavors.  Sometime soon I will be writing an article that will appear on Coding4Fun on how the game was created along with the full source code of the game.

    But, in the mean time, try out the game and enjoy!

    Read More

    Even More .NET-based Wiimote Applications

    I've received a few more emails from folks using my Managed Wiimote Library to do some cool things with the Nintendo Wiimote in Windows.  Here are a few more:

    Amazingly fantastic stuff.  I've created a list of projects using the library here.

    If anyone out there is using my library for a project, please let me know and send me a link so I can add you to the list!

    Read More

    C# MVP

    Woo hoo!  I was notified earlier today that I've been awarded the 2007 Microsoft MVP Award for Visual Developer - Visual C#!

    A gigantic thank you goes out to John Papa for nominating me for the award, and to the entire Microsoft MVP team for selecting me.

    Read More

    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!

    Read More

    XNA Timing Bug

    Update - 12/24/07: This issue has been fixed in XNA Game Studio 2.0.  Woo hoo!

    While working on my game for Maker Faire (which you’ll be able to download in about a month), I came across a timing bug on the Xbox 360 using XNA.  For an application that requires very accurate timing (millisecond precision), one can use the StopWatch object in .NET 2.0.  This was working quite well in my PC build, but on the Xbox 360 build, I would notice that time would drift with no explanation.  After digging around for a couple days and writing a simple sample to prove the point, I determined that the time value returned by the StopWatch object would drift by about 150ms/minute, which is considerable when precision within a few milliseconds is required (and considerable when it should be accurate to begin with).

    I eventually found a workaround:  DateTime.UtcNow.Ticks is perfectly accurate on both platforms.  So a quick rewrite to use this property in all …

    Read More

    Wiimote Applications

    I've received a couple emails in the past week of people using my Managed Wiimote Library to do some spiffy things.

    Brent Rossen's project allows one to interact with a virtual patient and is described as:

    This project was primarily created to allow the Wiimote to be used as a novel interface for a virtual environment. The goals were to create a Wiimote server, allow interaction with a virtual environment, and provide haptic as well as audio feedback. Six degrees of viewing freedom and stereo vision are provided via a Head Mounted Display and optical tracking system. Sound is provided through FMOD. Much of this project is built on top of code from the Virtual Patient Project.

    Evan Merz has created a virtual drum kit available at his site along with a video showing its operation.

    Great stuff, guys.  Anyone else using my library for a project?  I'd love to hear about it!

    Read More

    Maker Faire 2007

    I will be attending this year’s Maker Faire with the Coding4Fun gang.  We will have a variety of spiffy projects to play around with, including two I have done:  several “Wiimote-controlled” cars using my Managed Wiimote Library and Microsoft Robotics Studio, and a game written with my Ganksoft Entertainment cronies using Microsoft’s XNA Game Studio Express.  So if you’re in the San Mateo area, stop by May 19th and 20th and have a gander.  At only $15 for admission, there’s plenty to see and do…

    More details at (also linked above):

    Read More

    NYC .NET Developer's Group Event

    I will be presenting Interfacing External Hardware Using Managed Code and Microsoft Robotics Studio on Thursday, April 19th at the NYC .NET Developer's Group monthly meeting, which begins at 6pm.  I'll be showing off some cool toys from the Phidgets people (an RFID reader, interface kits, sensors, etc.), how to control hobby servos and motors via a PC, and wrapping up with an introductory look at Microsoft Robotics Studio.

    Come out and heckle!

    Read More

    XNA and 3D Model Exporting

    Here's an important safety tip that I wish I knew before the 4 hours I wasted on figuring it out.

    When building a model in 3D Studio Max (or likely every other modeling package in the universe), and then exporting it to a DirectX .X file via the Pandasoft X file exporter or kilowatt X file exporter plugins, ensure that the model has no meshes named with a space or period (or likely other characters).  This will cause the XNA importer and DirectX Viewer (or likely every other .X file importer in the universe) to fail with a very informative error like "Parser error" with no further information.

    We had a model that was working great.  My artist decided to tweak some things and add some new meshes, at which point the new version of the model stopped working.  At first we blamed it on the new parts that were added, then textures, then the exporter, then....who knows.

    Finally, after exporting the original model as a .X and the new model as a .X and …

    Read More

    I have been accepted as a new blogger by the good people over at  If you've never been there, you're missing out on some great technical content.

    My plan is to cross-post my technical content from this site to my new blog to reach a much wider and varied audience.  All non-professional/non-technical will remain here only.

    This blog isn't going anywhere and will be the superset of all content between the sites.  The blog will be the subset that is technical.  You choose where and what you'd like to read.

    Enjoy, and thanks to John Papa and the folks at CodeBetter!

    Read More

    April Fools' Day Application

    My latest article is up on MSDN's Coding4Fun.  Take a look and download a fun application to annoy your friends and co-workers on April Fools' Day.

    As always, questions and comments welcome.  If it's a question or comment that could benefit the masses, please create a new post over on the forum and I will reply there.

    Read More

    Exception Handlers

    Warning.  Rant coming…

    I was working on a project last week that included code that looked sort of like this:

    public bool SomeMethod()
            // do some lengthy, involved, critical process that,
            // if it fails, will cause the rest of the application to fail forever
            // as it leaves a required, persisted resource in a corrupted state
            return false;

    public void SomeOtherMethod() { SomeMethod(); }

    Of course, when I was debugging an issue in this application, SomeMethod was failing, yet I had no idea because the author of the code decided to not only throw away the exception that was being thrown, but not bother to check the return value of SomeMethod after it was called.

    So here comes the rant.

    Stop it!  Stop doing this!  Stop catching exceptions and either doing nothing with them, or throwing them away!  It’s an exception handler!  If you’re not going to handle the …

    Read More

    Wiimote and .NET

    Update 3/17/07: A new version of the code and assembly is linked from the article below which fixes a bug with the calibration data.

    My latest article has been posted on MSDN's Coding4Fun.  This time I have created a fully managed library to use a Nintendo Wiimote (and all current extensions) in C# or VB.NET.  You will find a description of what was done, source code for the fully managed library, a test application, and compiled libraries for you to start using immediately.

    As always, if you have questions, problems, feature requests, etc. please contact me and let me know.  If it's a question or comment that could benefit the masses, please create a new post over on the forum and I will reply there.

    Head on over and check it out!

    Read More

    Code Camp Lego NXT Source Code

    Well, if you attended my session, you know that something broke with MSRS and connecting to the NXT hardware.  Just so I can prove I'm not a total idiot, I'm sitting outside the session room right now and, of course, everything is working happily.  I downloaded MSRS, did a "Repair" installation, and everything magically came back to life.  <sigh>  Oh well.

    Anyway, I hope everyone was able to get something out of the session even if you didn't see the 'bot move.

    As promised, I have posted the source code (C#, VPL) and the PowerPoint presentation.  You can get the materials here.  If you have any comments, questions, or anything else to say, please don't hesitate to contact me or create a post in the forum for discussion.

    Enjoy, and thanks for attending!

    Read More

    The King

    Update 2/13/07: After reading this post, check out and bookmark this page for a list of all videos to date!

    Today, someone sent me a video of what is undoubtedly one of the coolest things I have ever seen.  If you are a regular reader, I'm sure you recall my Animated Christmas Lights article at Coding4Fun and accompanying video.  Today, I received a video of someone using my software and Phidget boards to animate something other than lights.  If you've ever been to a Chuck E. Cheese, you may recall one of the animated characters known as "The King" (photo from


    I have been told that The King shown in the video below was broken and left for dead.  After being salvaged from a dumpster, he was carefully repaired and restored, and once again animated and set to music using my Light Sequencer application normally used for Christmas lights!  I distinctly remember The King at my …

    Read More

    Holiday Light Show Part 2

    I have updated the article with some new source code and executables, and a video of the beginning of my first sequence using what I’ve built.  Take a look!

    Update: If readers of the article/blog have questions regarding the project, please use the Contact link above or use the new Forum topic so that I can respond to you.  If you have a comment which doesn’t require a response from me, please leave that comment below.  I’ve received several questions over the past few days entered as anonymous comments and I have no way to respond to them without cluttering up the section below.  Thanks!

    Read More

    Coding4Fun and Holiday Light Shows

    My latest article is now posted on MSDN's Coding4Fun website!

    We've all seen those animated, musical holiday light shows videos on the internet, or perhaps the beer commercial last holiday season.  I set out to create my own show using off-the-shelf components and .NET .  So, with one or many Phidget Interface Kits, some extension cords, and Visual C# Express 2005 or Visual Basic Express 2005, you too can create your own holiday light extravaganza!

    I'll be posting updates to the article as time goes on, including a video of my own show once completed, so check back often...

    Read More


    I was recently selected as a member of Microsoft's Coding4Fun writing team!  Coding4Fun is a site on MSDN devoted to geeks like me that enjoy building fun and quirky hardware and software projects using Microsoft technologies. My first two articles were for Halloween and can be viewed here:

    I will be contributing about one article per month.  I'll post here when new articles become available.  Lucky you.

    Read More

    Vista RC1 and Visual Studio Debugging

    I have installed a Vista RC1 and Office 2007 Beta 2 on a new partition and am attempting to use it as my primary OS.  So far, so good.  It has come a long way since the first builds I started testing.  There’s certainly more work to be done, but it’s looking more and more like a final product.

    On a tangent, symlinks are fantastic.  I know, welcome to UNIX circa 1985.  I am able to symlink my Firefox profile directory, Outlook config and .pst files, and a variety of other things from my XP parition to the Vista parition to share the data easily between the two operating systems.

    But, I post to note a few quirks with Visual Studio 2005 and debugging web applications.  By default, I was getting lots of errors about authentication, not being able to debug, and a host of other things.  The fix was quite simple.

    1) In the “Internet Options” control panel, go to the Security tab.  Add “http://localhost" to your list of …

    Read More

    XNA Game Studio

    I was really, really excited about the XNA Game Studio announcements the other day.  But, the more I learn, the less excited I become.  Read the FAQ for more information…

    The basics:  When the first beta of XNA Game Studio Express is released in 2 weeks, it will allow for Windows-only development.  Sometime before the end of the year, we’ll see an updated version that allows Xbox 360 development on retail hardware for those willing to spend $99 to join the “club”.

    That sounds really exciting.


    In Spring ‘07, we’ll see something known as XNA Game Studio Professional which is targetted at professional game developers to write approved titles using managed code for XBLA or commercial projects on a development Xbox 360.


    At the end of the day, after spending $99 to join the “club” that allows development on the 360, you’ll be able to run your own code on the 360, and that’s about it.  There is no …

    Read More

    Slow Toolbox Population in VS2005

    Everyone else in the universe has probably already figured this out, but in case they haven’t…

    I’m currently consulting on a farily large C# project using Visual Studio 2005. By fairly large, I mean about 27 projects in the main solution.

    There are over one hundred custom controls contained across these projects. When the application is built and I go to a design surface, VS2005 likes to update the toolbox with every possible drag-and-drop control it can find. As you might imagine, this takes a very long time complete, even on my 3.6GHz dual-core HT processor (Intel 840 EE).

    Well, I finally figured out how to stop it from happening: From the IDE’s main menu, click Tools -> Options -> Windows Forms Designer -> AutoToolboxPopulate = False . Additionally, there’s an option there to turn off the refactor when renaming a control, which also used to piss me off to no end.

    So there. You probably already knew this. And if you did, well, …

    Read More

    Excel and OLEDB in .NET

    While attempting to do some data merging across several Excel spreadsheets, I found some interesting behavior in how OLEDB determines data types of columns with an Excel source.

    For me, the issue manifested itself with a column that looked like the following (shortened for brevity’s sake):


    By default, Excel looks at the first 8 rows of each column to determine the type. If most of the items are numeric, it will create the column as an int or double type. The problem is, if the column also contains text data, like the one above (10134D), the column can’t be converted to a numeric type and OLEDB will just drop the value with no error or explanation.

    With the above data, since 4 out of 5 are numeric, OLEDB turns the column into a numeric type, and the 3rd row’s column of that data would be NULL.

    I tried several ways of fixing the issue but found that the only solution that worked was to set the IMEX property in the …

    Read More