Not Quite C

Not Quite C (NQC) is a programming language, application programming interface (API), and native bytecode compiler toolkit for the Lego Mindstorms, Cybermaster and LEGO Spybotics systems. It is based primarily on the C language but has specific limitations, such as the maximum number of subroutines and variables allowed, which differ depending on the version of firmware the RCX has. The language was invented by David Baum. He has released two books on the subject.

Simple program example

A simple test program written in NQC for an RCX with a motor connected to output port A could look like this:

 task main ()    // Main program
 {
     SetPower(OUT_A, OUT_FULL);    // Turn on motor A at 100% power.
     OnFor(OUT_A, 200);            // Let the motor run for two seconds, and then turn it off.
 }

Thus, motor A will go at full speed for two seconds before being turned off.

Compilers and integrated development environments

NQC compilers and integrated development environments (IDEs) are available for many platforms including Microsoft Windows, Mac OS X, Linux, BeOS and DOS. One is the Bricx Command Center.

gollark: Maybe I should offer a randomness stream like OIR™.
gollark: (you may adjust the quantity of bytes, of course)
gollark: Anyway, you can get all your one-time pads from here: https://osmarks.net/random-stuff/random/bytes/1024
gollark: For security, you understand.
gollark: Those are disabled on the bees.

References

    Sources

    Compiler sources:

    IDE sources:


    This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.