4
Not Quite C
In this chapter:
• A Quick Start
• RCX Software Architecture
• NQC Overview
• Trusty Revisited
• Online Resources
Once you've written a few programs in RCX Code, it feels a little constrictive. For one thing, there aren't any variables. It would be nice if your robot could remember things, like how many
obstacles it's encountered or what the temperature was three minutes ago. In RCX Code, the only thing remotely resembling a variable is the counter. Back in Chapter 3, Trusty, a Line Follower, I
used the counter to remember which way to turn. The counter was always a 0 or a 1, indicating whether the robot should turn left or right. But it's tough going, and if you try anything more
complicated, the counter is not going to get the job done.
The lack of variables is only one of the limitations of RCX Code. Two other important limitations are:
• Although you can define subroutines (called "My Commands"), you can't call one subroutine from another. Likewise, a subroutine can't call itself.
• You can't control the RCX's display very well. It would be really nice, for debugging purposes, to be able to show values on the display.
The LEGO Group aimed the Robotics Invention System at people who had never programmed before. For this group, RCX Code is a gentle way to get started with programming mobile robots.
But RIS is exceedingly popular with programmers and other technically savvy people, who are frustrated by the limitations of RCX Code. If you're reading this chapter, this probably includes you.
Since RIS was released in the Fall of 1998, the MINDSTORMS community has produced an amazing stream of clever, innovative software designed to overcome the limitations of RCX Code.
Most of this software is available, free of charge, on the Internet. In this chapter, I'll describe one of the most popular packages: Not Quite C (NQC). NQC allows you to write programs for your
RCX with a text-based language. I'll describe the syntax and commands of this language, with copious
Page 53
Need help?
Do you have a question about the MINDSTORMS Robots and is the answer not in the manual?
Questions and answers