Hobby project – Lego NXT, XBox 360 controller, PC and C#. Part 2

By | 3. August 2015

Back to Part 1

Now when hardware is present, configured and functional it is time to set up software for development.

We will use C# programming language and brand new Visual Studio 2015.  Visual Studio 2015 Community edition can be freely downloaded here. After download the installing will take some time but is quite straightforward.

Next we have two programming task to complete:

– Communication with XBox controller

– Communication with Lego NXT

For XBox communication there is excellent article with source at http://www.codeproject.com/  – Using XInput to access an Xbox 360 Controller in Managed Code.

If you intend to use Windows 7 then do not forget to define compilation condition WINDOWS7

Compiling For Windows 7

Compiling For Windows 7

XInpit.cs is depending on different dll-s in case of Windows 7.  The code can be rewritten to be universal, but we will look at it on later stage.

XInput.cs

XInput.cs

 

But it you want to make your hands dirty immediately then there is shortcut for Windows 7 precompiled J2i.Net.XInputWrapper.dll – J2i.Net.XInputWrapper. This is all we need.

 

For second task there are many dot.net libraries for Lego NXT API. We choose MonoBrick. It can be found at ww.monobrick.dk. In this fine site you can find multiple samples and documentation. As prefix Mono refers the library is usable also on other platforms than only windows. Also version for latest Lego EV3 platform is available. What we need is  MonoBrick Communication Library, find  on page download Library DLL :

 

MonoBrick

 

Now we are ready to start our software project in next post.

2 thoughts on “Hobby project – Lego NXT, XBox 360 controller, PC and C#. Part 2

  1. Pingback: Hobby project - Lego NXT, XBox 360 controller, PC and C#. Part 1 - Software Blog

  2. Pingback: Hobby project – Lego NXT, XBox 360 controller, PC and C#. Part 3 - Software Blog

Leave a Reply