Just for fun, controlling a Lego Mindstorms NXT robot with Windows Workflow Foundation
Recently I was asked to give a presentation on Windows Workflow Foundation to some developers. Unfortunately I had never worked with it. So last week while I was reading an article about workflow, it occurred to me that the designer seemed very similar to the NXT-G programming environment my kids use to program their Lego (R) Mindstorms (R) NXT robot. There's no better way to learn something than to actually try to do something real with it, so I decided to try to write my own custom activities to control a robot through Bluetooth connection.
Now this is a silly little app that doesn't do anything useful, but I thought it was too interesting to let the code just languish on my hard-drive only to be cleaned up someday when I'm low on space. It served it's purpose for me to learn Workflow Foundation better. I just posted the code to the MSDN Code Gallery here: http://code.msdn.microsoft.com/NXTWorkflow. There's plenty of room for improvement, but it was sure fun to write.
It includes a console driver program, as well as a Winforms based application that hosts the Workflow designer. The designer hosted version is based on the excellent MSDN hosting example by Vihang Dalal found at http://msdn.microsoft.com/en-us/library/aa480213.aspx. The bluetooth communication uses a wrapper called NXT# written by Bram Fokke at http://nxtsharp.fokke.net.
The robot I used to develop the application: