Page 114 -
P. 114

243_MasterPieces_02b.qxd  4/18/03  6:59 PM  Page 86




           86     Masterpiece 2 • The Learning Brick Sorter




                    Bricks & Chips…
                    Multiple Connectors? Single Port?

                    How can the RCX distinguish between the readings coming from two sensors
                    attached to the same port? This particular trick works because the light sensor
                    returns readings that never reach the maximum value of its range. In fact, the
                    light sensor returns a number representing a percentage which in normal condi-
                    tions never read 100 percent. The touch sensor, configured as a light sensor,
                    returns either 0 when released or 100 when pressed. Thus, in the program we
                    can deduce that if the reading is 100 the touch sensor is pressed, otherwise the
                    sensor is released and the reading is what returned by the light sensor. This trick
                    is very useful to save input ports, provided that you don’t need to read the light
                    sensor when the touch sensor is pressed.



            Final Step 26









































                                                              Connect the motor attached to the
                                                              Body sub-assembly to Output Port A.
   109   110   111   112   113   114   115   116   117   118   119