The Lego Mindstorms Kit

Programming the Brick

Lego Mindstorm kits come with a development environment that is designed to be simple for children to understand. University students of Computer Science may also be able to understand it. The development environment provided by Lego is a Microsoft Windows tool.

This environment will also work under VMware, but has some problems doing so. In particular, the Lego Mindstorm SDK limits you to storing your code in a "software vault". Unfortunately the location of this vault is fixed to a directory on the Windows C: drive - this means that code can not be loaded/saved in a network drive i.e. to your home directory, via samba.

The choice of development environment is wholly up to your group. However, some convenient tools you may well choose to use are Not Quite C (NQC) and the Bricx Command Center, which are Windows based. Their software can be downloaded from those sites but is also available at NQC and Bricx. Each group has been provided with copies of "Programming Lego Robots using NQC" and the "NQC Programmer's Guide". As you come to learn NQC, you may come to regard it more as NLC (Nothing Like C)!

There are also several development environments that are Linux based. These are well described in the Lego Mindstorm with Linux Mini-HOWTO

There is a huge amount of Mindstorm material on the WWW; it would be quite easy to spend all four weeks trawling through it :-)

Firmware

Firmware provides a Virtual Machine emulator running on top of the Hitachi microprocessor in the RCX brick. The commands in this virtual machine are described in the RCX 2.0 Firmware, Command Overview document you have been provided with. This is the byte code that NQC compiles to. References you may come across to LASM files refer to the assembly code for this code. The latest RCX2 firmware is at firm0328.lgo should you need to download it. This can be done from the Bricx Command Center, for instance.

Code Samples

Sample programs may be made available from time to time for you to make use of if you wish. Although your communications with the Brick will be from WinCE running on the Arcom board via a serial line and the IR tower, here are a couple of Linux programs which communicate with a Brick that you may nevertheless find useful to avoid reinventing the wheel:


David Rees djr@dcs.ed.ac.uk Last edited: 28/3/2002