Programming Highlights


RCXes can communicate with each other via their infrared ports. To communicate, one RCX sends a message to another RCX that is programmed to receive a message. Just as an RCX must be programmed to get input from touch or light sensors, it must be programmed to receive and process messages. Thinking about the receiving end, it may be helpful to draw an analogy to the light sensor watcher. In the case of a light sensor, a watcher is set to check whether light values fall within or outside a set range. A comparable mechanism is set for the message watcher that checks whether an incoming message (number) is within or outside a set range. If the incoming message is within the set range, the attached stack is set off. There are two ways to check messages—IR Sensor Watcher and IR Stack Decision Makers. Note that all Stack Decision Makers but Repeat While can make decisions based on IR input.

Sending a message

 A program can send a message at any time. The message is sent via the infrared port on the RCX (located on the side you would point to the IR tower when downloading a program). The message is a single, arbitrary number between 1 and 255. A program can be constructed to send a message once, repeatedly, or whenever a condition becomes true or false. Click here to see examples that illustrate each of the above options.

Receiving a message:

 A program has to be set to receive a message and act on it, just as it has to be set to receive light or touch information and act accordingly.

There are two ways to set up a program to receive a message: IR Sensor Watcher and Stack IR Decision Makers (Yes or No, Wait Until and Repeat Until). In both the receiver sets the condition for the incoming message. It then evaluates incoming messages for whether or not they meet the condition (e.g., equal to a number, greater or smaller than a number, or within a range). The range can be set to any numbers between 1 and 255. Click here for some examples.

Clearing a message

An RCX starts with a clean slate in the “message box” the first time a program is run. When the first message is received and evaluated, the message stays in memory. For a new message to come in, the old message must be cleared first.

If you do not clear a message, the program will receive a message once (i.e., it captures the 1st incoming message) and will then ignore subsequent incoming messages. Click here for an example.



Tech Guide










Tech Guide













Tech Guide


Return to Top