This describes my experience playing with a very old (copyrights say 1998) Lego Mindstorms set I was given. The controller is an RCX 1.0 unit. It was possible to play with this using Linux.

Download Not Quite C (nqc). I used:

http://bricxcc.sourceforge.net/nqc/release/nqc-3.1.r4.tgz

Careful as this is a messy tarfile (make a sub directory).

There was no readme for compiling but it was as easy as it gets. Just type make.

You should have a ./bin directory which contains nqc and mkdata.

Set up your serial connection from the computer to the transmitter base station (USB to serial works fine). I don’t know what serial settings are really being used. In minicom, 9600 shows some activity, but it’s binary gibberish. Also you should be able to get the green transfer light to come on on the transmitter base station by typing.

My RCX sat unpowered for a long time and needed it’s firmware installed. First get the firmware file off of the otherwise useless CD. That file is in /firm/firm0309.lgo.

Use the nqc binary for installing the firmware. Make sure the base station is pointing at the RCX and everything is plugged in and powered up:

./bin/nqc -S/dev/ttyUSB0 -firmware ../cd/firm/firm0309.lgo

Or better if the RCX is close to the transmitter and the range setting (small triangle on transmitter) is set:

:-> [~/mindstorm/nqc]$ ./bin/nqc -S/dev/ttyUSB0 -firmfast ../cd/firm/firm0309.lgo
Downloading
firmware:..................................................................................
Current Version: 00030001/00030009

If you get some vague error, try unplugging the serial converter and looking at dmesg to see where it assigns the ttyUSB device upon reconnection. Then try again with that.

Then find the included test program in the nqc distribution and load that:

./bin/nqc -S/dev/ttyUSB0 -d test.nqc
Downloading Program:..complete
Battery Level = 8.0 V

It returns the battery level which is good I guess, but it returned 9.0V but the RCX gave me a battery icon warning but when I switched batteries it read 8.0V on upload (firmware had to be repeated too) but it ran fine. Go figure.

This test program runs when you push the green "Run" button on the RCX. It is supposed to make a motor attached to RCX pad A spin until a touch switch on RCX pad 1 is closed and then it stops.

Note about the 71427 motor units

At first the test program didn’t quite work because the motor didn’t spin. I never have used this set and it turned out that the motor was seized up. Switching motors, it worked fine. I also was able to get the other motor to turn, albeit weakly, by freeing it up by turning its shaft with a pair of pliers. I suspect corrosion of some kind in there.

Commands

Here are some things you can do with the RCX from nqc.

Print the datalog, if populated, on the stdout:

$ ./bin/nqc -S/dev/ttyUSB0 -datalog
Uploading Datalog

Sets the clock on the RCX to the time of the computer:

$ ./bin/nqc -S/dev/ttyUSB0 -watch now

Set auto shutoff timer to this many minutes:

$ ./bin/nqc -S/dev/ttyUSB0 -sleep 5

Load a program to slot 3 (one can load 5 different programs concurrently) and run it:

$ ./bin/nqc -S/dev/ttyUSB0 -d test.nqc -pgm 3 -run

Just run the program in slot 3:

./bin/nqc -S/dev/ttyUSB0  -pgm 3 -run
Sample Program
#define BUTTON  SENSOR_1
#define MOTOR   OUT_A

int more;

void outnback(int frames) {
    repeat (frames) {
        SetPower(MOTOR,7);
        OnRev(MOTOR);
        Wait(500+more);
        Off(MOTOR);
        OnFwd(MOTOR);
        Wait(500+more);
        more+= 10;
        Off(MOTOR);
        until(BUTTON == 1);
    }
}

task main()
{
#ifdef __RCX
    // RCX needs to be told what kind of sensor is used
    SetSensor(BUTTON, SENSOR_TOUCH);
#endif

more= 0;
outnback(300);

//On(MOTOR);
//until(BUTTON == 1);
//  PlaySound(SOUND_CLICK);
//  Off(MOTOR);

}