Toying With Technology

Getting to know "Not quite C"

(An introduction to computer control using "not quite C") ______________________________________________________________

 

Upon completion of this lesson you will be able to:

          "Not Quite C", also referred to as NQC, is a programming language derived from the original C style programming language.  David Baum created NQC explicitly for programming LEGO® robots.  With the help of the RCX Command Center, NQC is used as a very simple tool to create and execute programs to control devices.  Follow these steps to complete your own program.

STEP 1:

Assemble the LEGO® car.  The directions for doing this are located in the MINDSTORMS Rover.doc document located on your computer’s desktop.  The black cables will need to connect the motors to output ports A and C.

STEP 2:

Open the RCX Command Center: To do this, on the desktop, find the RCX icon and double-click on it.

It Should Look Like This:          

 

When you have successfully opened the RCX Command Center you will see a small screen saying it is searching for the RCX.  Make sure Automatic is selected on the left, and MINDSTORMS is selected on the right.     

 

 At this time make sure the MINDSTORM'S car is properly assembled and the black part on the front is facing the infrared tower.  Turn the car "on" by pressing the red “on-off” button on top of the RCX and then click OK on the screen.  The device should automatically locate the robot for you through infrared transmission, the same way a TV remote control works. Next, the main screen should appear.  The first thing you need to do is open a pre-written program file.  You can do this by clicking on file at the top and then dragging the mouse down to open.  Change the "look in" window to My Documents.   Open the file called prog1.nqc.   Look at this program and hypothesis what you think the program is going to have the car do.

STEP 3:

Compile the program.  You can compile the program in several ways: directly click on the compile icon on the toolbar (blue group of ones and zeros); or press the F5 key on your keyboard. After compiling the program, the computer will  pause for a second and then report any errors (including approximately what lines of the program they are located on) if there are any.  You can correct your errors (see the page in your packet called Troubleshooting) and re-compile if necessary. After compiling be sure to save your program (with a different file name) under file, in the main menu.  When you save your program, create a new folder and save it in there.  This can be done by choosing Save As and then clicking on the icon of the closed folder at the top.  You can name your folder whatever you want.  Save all of your programs throughout the semester in this folder.

STEP 4:

Download the Program: To download the program, simply click the blue, upside-down triangle or press the F6 key. Place the car directly in front of the infrared transmitter in order to download, failure to this action may result in a "frozen computer."  (If this happens, see the page in your packet called Troubleshooting). A successful download will result in a series of beeps from the car.

STEP 5:

Run the Program: To run the program, simply press the green “run” button on the RCX itself.  A small "running man" on the display will let you know that your program is running.  Did the program do what you expected? If you would like to stop your program press the run button again.  When you are finished, remember to turn off your RCX.

Congratulations! You have now successfully programmed the RCX LEGO® car using "Not Quite C".

____________________________________________________________

 Remember the steps we took to complete this process:

STEP 1: Assemble the car

STEP 2: Open, write, and edit the program

STEP 3: Compile & Save the program

STEP 4: Download the program to the RCX

STEP 5: Run the program on your RCX

Back to Contents

On to Lab 1 - Making the Robot Move