Adding Light Sensor to LEGO Mindstorms Robot Arm
01/19/2007: Well, I finally had some time on my hands, so I decided to add the light sensor to the LEGO Mindstorms robot arm. This allows the processor to distinguish between different colors.
Adding the sensor was quite simple. Total time elapsed: less than 60 seconds. That sensor mounts on the servomotor right behind the clamps, as shown in the following pic:
The programming for the light sensor was mostly trial-and-error, as I attempted to determine the threshhold for which the sensor would distinguish the red ball while ignoring the blue ball.
To handle this, I used a switch object, and had a set of instructions to process for the red ball with other instructions in the event that the red ball was not detected.
The program is shown below.