
Page 53
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
Summary of Contents for MINDSTORMS Robots
Page 22: ...Page 18 The back tread wheels are anchored to the shafts with the 16t gears ...
Page 23: ...Page 19 Page 20 Next start building support for the drive motors ...
Page 26: ...Page 23 The touch sensors are attached only by the shaft that runs through them ...
Page 41: ...Page 41 ...
Page 43: ...Next build the support for the light sensor ...
Page 80: ...Page 85 Make sure the bump on the long pin is up against the 4u beam ...
Page 82: ......
Page 84: ...Page 89 ...
Page 85: ...Step 14 is similar to Step 11 take a deep breath and go slowly ...
Page 87: ...Page 91 ...
Page 88: ...Page 92 Make sure that the two sides are at the same angle They should mirror each other ...
Page 89: ...Page 93 Page 94 ...
Page 90: ...Structural Support Page 95 ...
Page 91: ...Idler Wheel Page 96 ...
Page 92: ...Page 97 Drive Motor ...
Page 93: ...While you re putting the motor in hold on to the worm gear so it doesn t slip off Page 98 ...
Page 94: ...Grabber Arm Motor ...
Page 95: ...Page 99 ...
Page 96: ...Page 100 RCX Attach the RCX on both sides as shown Page 101 ...
Page 158: ......
Page 159: ...Page 175 The 16t gears are nestled inside the tread wheels ...
Page 160: ...Page 176 ...
Page 161: ...Page 177 Attach the motors to output A and output C as shown Page 178 ...