Talk to an RCX from a serial port on a Linux box

All my good computers run Linux, so I don't have machine handy for using the official Lego Mindstorms software. So I started to write my own program to talk to an RCX in Perl 5.

It is now at a point where it is usefull for experimenting with the protocol. But not for much else. It takes care of all the packet overhead.

23 April 2001 It's been a few years, some folks have written some books.

I'm sure more stuff will come along. Search Amazon.com for "Mindstorms".

3 December 1999! A win32 port.

New version as of 7 October 1998!. It is in talkrcx.txt.

I read Kekoa Proudfoot's RCX Internals.

I read Lego Mindstorms Internals, maintained by Russell Nelson.

Here is a sample run of the program. The program is called talkrcx, it has the imaginative prompt Type>

.

The computer output is in standard type.
What I typed to the program is in bold.
I added comments in italics.


$ ./talkrcx This is a very early version, complete with warnings from the Perl compiler.
Identifier "main::rout" used only once: possible typo at ./talkrcx line 76.
Type> 10 10 is the ping command
No response header: sent 55 ff 00 18 e7 18 e7 
       got 
In:   Hmm, no response, I forgot to turn on the RCX.  Try again.
Type> 10
In: e7
Type> 10 Normally you ping twice to sync up the sequence number
In: e7 The program filters out the sequence bit, this might have been ef.
Type> 12 9 1 Read sensor 1, in this case a light sensor.
In: e5 20 00   That is 32 in decimal
Type> 12 9 1 again
In: e5 2f 00  That is 47, I put a piece of paper in front of the sensor

To use the program, just grab the source, talkrcx.txt.
Edit the file and change the portname to match where you plugged in your IR tower.
Remove the ".txt" from the name, mv talkrcx.txt talkrcx.
Change the permissions, chmod +x talkrcx.
Run it ./talkrcx

Obviously, this is a start, not the final product. To run this version, you need Perl 5 on Linux. It should be easy to port to other systems.


Joerg Diessl's win32 port

Joerg wrote:
thanx for your talkrcx! i translated it for use under win32-systems. furthermore i have written a server that enables you to control an rcx via the web.

sources and infos at www.testphase.at/linx


I am Paul Haas. My website is hamjudo.com.