Project Description
NXT.NET is a .NET library written in C# 3.0 that enables host applications to control the LEGO Mindstorms NXT from managed code via Bluetooth connection. NXT.NET contains a desktop and a mobile library and sample desktop Windows Forms and Windows Mobile Pocket PC applications.

The download contains code snippets from the mobile and the desktop remote application to demonstrate how to use the library and help you getting started writing applications with NXT.NET. The source code is also published as a separate download (May 26 2010).

NXT.NET is created by the Hungarian MSDN Competence Center (and not by the LEGO Group). Please visit our homepage at http://www.msdnkk.hu or send us direct feedback to msdnkk at aut dot bme dot hu. Thank you.

György Balássy
Microsoft Regional Director, Hungary, ASP.NET MVP
MSDN Competence Center

Components

NXT.NET contains the following components:
  • NxtNet.DesktopLib and NxtNet.MobileLib are two class libraries with the same feature set compiled as a desktop and as a mobile component. The library enables the host application to control a LEGO Mindstorms NXT robot via a Bluetooth connection. See the Library Help Screenshots here.
  • NxtNet.DesktopApp is a .NET Windows Forms desktop application that is built using the NxtNet.DesktopLib component and enables the user to test the library features and remotely control a LEGO Mindstorms NXT robot from a PC. See the Desktop Screenshots here.
  • NxtNet.MobileApp is a .NET Compact Framework mobile application that is built using the NxtNet.MobileLib component and enables the user to test the library features and remotely control a LEGO Mindstorms NXT robot from a Windows Mobile 5.0 Pocket PC. See the Mobile Screenshots here.

Current project status

The library currently enables the host to connect to the NXT, query general parameters (brick name, version, Bluetooth address, free flash memory, battery level, keep alive time), initialize sensors and query sensor values. These features are already available in the desktop application and partly in the mobile application. The library is fully documented in the C# source code with XML comments in English.

Major part of motor control is also implemented but not fully tested yet. Querying sensor states is not tested from the mobile client and not available in the mobile application. Direct Bluetooth communication is also implemented but not fully tested yet.

Technical background

NXT.NET is written in C# 3.0 and compiled with Visual Studio 2008 to the .NET 3.5 platform. The single source code of the library is compiled as a desktop library to .NET Framework 3.5 and also as a mobile library to .NET Compact Framework 3.5. The sample desktop application is a Windows Forms application and the sample mobile application is a Smart Device Application optimized to Windows Mobile 5.0 Pocket PC.

The HTML help documentation (CHM) is compiled with NDoc 1.3 and the Microsoft HTML Help Workshop using the extensive XML documentation in the C# source code.

NXT.NET uses the .NET Framework's SerialPort class to communicate with the NXT brick via a Bluetooth connection that is simulated as a COM port on the PC or the Pocket PC. The remote control is implemented with the direct commands of the NXT.

Last edited May 26, 2010 at 6:29 AM by balassy, version 24