Programming for light sensor input: Like programming for touch sensor input, the RCX has to have a program that can act on incoming light sensor information. For example, if a program is set to run a certain way if the sensor detects bright light, then the program must have a way of monitoring changes in light levels.

RCX Code offers several ways to obtain light sensor input, using Stack Decision Makers (red, orange, or purple blocks) and Sensor Watchers (blue blocks).

Stack Decision Makers are incorporated in a stack of commands, checking for sensor input when their turn to run comes. The program then continues top-down, block after block. The Wait Until block does what it says, it waits until a certain condition is met. The Repeat While repeats a stack of commands while a certain condition is met, and the Repeat Until does the same until a certain condition is met.

Sensor Watchers also check for sensor input, but they are not embedded in a stack of commands. They are connected to the program at the top level (to the programís title block). At this level, Sensor Watchers monitor the sensors all the time (with preset intervals), checking for input repeatedly while other parts of the program continue to run. With Sensor Watchers, a program can monitor up to nine sensor events.


Close Window