NQC
NQC - Not Quite C - A programming language for the Lego RCX
Programming The Lego RCX with NQC
There are many programming languages for the RCX. While I was using the RCX a great deal, I found NQC made the most sense to me.
NQC is an acronym for “Not Quite C”. NQC is a C-Like programming language, API and compiler toolkit aimed at Lego’s range of Programmable Bricks. Being an embedded C programmer by trade, NQC was an obvious choice for me.
Learning a more advanced language like this is a vital step in working with Lego Robots as NQC gives you a great deal more control and flexibility than the supplied MindStorms, CyberMaster or SpyBotics software. NQC gives access to more programming concepts than the construction toy style SDK’s provided. On the downside, NQC can be more complicated for those not familiar with C, and for those who are, NQC’s differences (the not-quite aspects) may be a little frustrating.
The language draws highly from C, although some concepts, like the way tasks are handled are fairly specific to the language. NQC has a few caveats – like not being able to return arguments from subroutines and having a limit of subroutines (which is governed by the target – RCX 1.0, RCX 2.0 etc.). These limitations mean that you will often need to use global variables.
task main() { OnFwd(OUT_A); OnFwd(OUT_C); Wait(200); Off(OUT_A + OUT_C); }
NQC is a command line compiler, and not a development environment, so I suggest using NQC with a text editor like VSCode. The NQC website has the details for installing it on windows, although installation is a bit more involved on the Mac and Linux. NQC does not require the original RCX software to be installed to run.
Some other advanced systems for programming Lego P-Bricks are LegOS and BrickOS. NQC is the easiest, but the others are also worth a look.
NQC Links
I used the NQC language on the RCX enough to collect a few good links.
- NQC - Not Quite C website - The home of the NQC programming language for the RCX and is maintained by its author. This contains all the downloads and the documentation to use the software.
Even more NQC info
NQC is a deep a powerful tool for the RCX. While a subset of the C language, NQC has enough to accomplish fairly complicated tasks with the robot kit. However, getting the best of NQC requires either great experience, or having a good book to use as a guide, a tutorial or just a reference to keep handy.
Little beats being able to go step by step through a book, or rifle through to find exactly what you needed to solve a problem.