So you have come to realize that you need to use more sensors then you have ports for. No problem! We can combine two sensors on one port. Most of the RCX sensors interfere with each other, so combining two light sensors is out of the question. We can however combine a touch sensor with any other sensor in the following manner. Lets say that we had a set up as follows, we put a light sensor and a touch sensor on port 2 of our RCX like in figure 1; the order of the sensors does not matter.

Figure 1
In this configuration the RCX will read the light sensor value if the touch sensor is not being pressed, and a light value of 100 if the touch sensor is engaged. Now lets take a look at a RoboLab program to use this idea.

Figure 2
Figure 2 shows a RoboLab program written for the following situation. The robot will wait until a light is turned on, then the robot will go forward until the touch sensor is touched. We start off with a wait for light value. Once the light reading is greater then 50 we go forward. We then wait until the light value is greater then 99. Since the touch sensor will make the light sensor read 100 the statement will execute and the program will end. It should be noted that in this case a very bright light could cause the program to end anyway because the light sensor will read a value of 100.
If you have any questions, comments, or concerns, please contact: David Chamulak