fuhan's Lego MindStorm page

Lego MindStorm with NQC(win9x version)

by Chang Fuh Han

This is a page for Lego MindStorm beginners who want to get their robots up and running as quickly as possible but who can't stand the limitation of the supplied RCX Code. I won't attempt to describe exhaustively the syntax and commands of this language since there are already several webpages doing an excellent job of it. Rather the main emphasis of this webpage is to supply the reader with NQC examples which you can then download to your Mindstorm to get it up and running.

For those of you who are more mechanically inclined, you might want to check out Ben's Lego Creations. The page contains some fascinating robots (esp Ben's FetchBot) and has downloadable PDF files with detailed descriptions of his robots (incl photos).


Since RIS was released in the Fall of 1998, a variety of software had been released to help overcome this limitation. Among the most popular packages is Not Quite C (NQC). NQC is written by Dave Baum. Check out his website to download the current release, read the documentation or browse a FAQ. It works in a DOS environment.

If you are someone like me who prefers to work in a 'comfortable' windows environment, you will be interested in the RCX Command Center (RcxCC). The RcxCC is developed by Mark Overmars and is built on top of NQC. The RcxCC provides a nice windows interface to all the features of NQC and includes a program editor, real-time control of the RCX(with a mouse) and a piano to play music on your RCX. I highly recommend this application.

Other programming environments

You might be wandering what are the other programming environments available for the RCX. Besides NQC, there are pbForth and legOS. Both pbForth and legOS are replacement firmwares (which means they actually replace the software on the RCX. In comparison, NQC just makes use of the software supplied by Lego) and both represent the next level of power and complexity beyond NQC.

Click on their respective links above to find out more.

legOS is the most powerful development tool available. You might want to give it a try if you have

Apparently, this group at LEGOLAB at University of Aarhus implemented some kind of neural networks and network communication in the LEGO system using legOS. This stuff is way above my head.

My Assumptions

I would assume that you have

- a Robotic Invention System (RIS) kit with the firmware already downloaded into the RCX. If you have 2 sets of RIS, so much the better.

- RcxCC (version 3.0 or higher) properly installed. Download it from Mark Overmars' website.

- NQC tutorial by Mark Overmars. Available in PDF, Ms Word, PostScript and RTF format. Provides a gentle and thorough introduction to NQC.

- you have already built a roverbot (pg 10 of your Constructopedia). Paid special attention to the way you connect the wire bricks to the motor.

NQC Examples

I have having trouble uploading *.nqc files to the geocities server. So cut and paste from these text files into your RCX Command Center. Be careful when you cut and paste. I suggest you maximize your browser when you cut and paste to minimize errors.

Example 1: Make your roverbot move forward for 5 sec and backward for 4 sec and then stop.

Example 2: Same as in Example 1 but roverbot must restart 3 sec after stop. It will then make a left turn 90 degrees and continue forward for 2 sec. Finally, it will make a right turn 90 degrees before stopping.

Example 3: Have your robot follow the dark line in both clockwise and anti-clockwise directions. Mark Overmars' tutorial has a program on pg 18 that works only in a clockwise direction but mine works in both directions. You might want to modify the program using FLOAT command to make it run smoother.

Example 4: Assuming you have a single bumper attached to your roverbot, make it exhibit random behavior whenever its touch sensor hits an obstacle.

Example 5: Same as in Example 4, but rather than exhibiting random behavior make it go back to its starting position after hitting an obstacle.

Example 6: Same as in Example 5 but this time use the light sensor (as a 'proximity' sensor) rather than the touch sensor.

Example 7: Use one RCX as a remote control for your roverbot. Call this the 'master' RCX. Example 7 is for the master.

Example 8: This would be for the remote-controlled roverbot --the 'slave'.


Lego MINDSTORM : Official site of Mindstorm.

LUGNET : The international fan-created LEGO Users Group Network. This is the hub of the whole online Lego universe.

NQC : Download NQC here. This works in a DOS environment.

RCX Command Center : Let you use NQC in a Windows environment. I highly recommend this program esp if you are more comfortable in a windows rather than a DOS environment.

Lego Mindstorms Internals : This site has a lot of links to Mindstorm-related sites. Definitely worth a visit. Also offers a mailing-list which you can join.

Mario Ferrari's Home Page : Have a look at some of Mario's robotic creatures. You can e-mail him if you want his nqc codes.

Bert van Dam's Home Page : This guy does some artificial intelligence stuff with Lego Cybermaster (similar to Mindstorm) using QBasic and Visual Basic. Also offers Basic program downloads.

Contacting me

Contact me at the address below. Replace [at] with @ to mail me.


LEGO MindStorms WebRing
LEGO MindStorms WebRing
Site Owned By: fuhan

Control Panel
[ Skip Prev | Prev | Next | Skip Next ]
[ Prev 5 | Random | Next 5 ]