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 originally provided by Lego runs under Microsoft Windows. This has been installed on the two Windows PCs in the lab in case you wish to use it. This environment will also work under VMware on Linux, but there are one or two minor drawbacks such as the fixed location of the so-called 'software vault' it uses.

Environments and tools which run under Linux are available. A convenient tool you may well choose to use is Not Quite C (NQC). This has been installed as an RPM on the group Linux PCs. There is a man page. Two associated documents you will find useful are "Programming Lego Robots using NQC" and a "NQC Programmer's Guide". As you come to learn NQC, you may come to regard it more as NLC (Nothing Like C)!

NQC can be installed on Windows PCs if you wish. The software for this version can be downloaded from the NQC site but is also available here. Another Windows-based tool which is useful is the Bricx Command Center. It can be downloaded from that site but is also available at Bricx.

There are several other development environments that are Linux based should you wish to investigate them. These are 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.

Each group get two Lego kits. This gives you more bits and pieces to play with, extra motors and, probably most importantly, an extra RCX brick. The second kit is a Mindstorms2 kit however which has one or two differences from the first one. These differences include a USB-based Tower and what looks like a more powerful IR transmitter with a longer range. Read the FAQ about the new version.

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. 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 either from NQC or from the Bricx Command Center.

Code Samples

Sample programs may be made available from time to time for you to make use of if you wish. Here are a couple of Linux programs which communicate with a Brick that you may find useful to avoid reinventing the wheel: