Page 208 - Robots Androids and Animatrons : 12 Incredible Projects You Can Build
P. 208

light is too bright, it jerks backward. With a mediocre light source,
                                       it will aim and travel toward the light.
                                       The program can be developed further to explore more interesting
                                       and exotic behaviors. Before doing so, let’s first look at how the
                                       standard program functions. Program 1 for microcontroller 1 pri-
                                       marily checks the sensors and transmits the results to microcon-
                                       troller 2. In this program you can modify the sensor sensitivity to
                                       compensate for different sensors, for instance, by using the lines
                                       if b0 <= 250 then skip  ‘Is it dark enough to sleep?
                                       if b1 >= 250 then slp  ‘Yes
                                       skip:   ‘No
                                       The maximum reading from the sensor can be 255 (total darkness).
                                       This may be raised to increase the ambient light intensity for sleep.
                                       The brightness that triggers the avoid mode may be modified by
                                       using the following lines:
                                       If b0 > 25 then skip2  ‘Is it too bright to live?
                                       If b1 < 25 then avoid  ‘Yes
                                       skip2:   ‘No
                                       Increasing the numerical value, in this case 25, decreases the light
                                       intensity that puts the robot into avoid mode. Decreasing the nu-  187
                                       merical value increases the light intensity needed to throw the robot
                                       into avoid mode. In most cases you will want to decrease this num-
                                       ber. However, I would advise not going below a numerical value of 9,
                                       because even at full light saturation of the CdS cell, its resistance
                                       never drops to zero. And in my light saturation tests the sensor
                                       never yielded a value less than 5.
                                       Tolerance between the two CdS photoresistors may be increased
                                       or decreased by modifying the numerical allowable difference in
                                       subroutines greater and lesser.
                                       greater:
                                       b2 = b0   b1
                                       if b2 > 10 then rt
                                       goto straight
                                       lesser:
                                       b2 = b1   b0
                                       if b2 > 10 then lt
                                       goto straight
                                       In addition, one could create handedness in the robot (right- or
                                       left-handed) by modifying either the greater or lesser subroutine,
                                       but not both. This will create a robot that is more likely to turn in
                                       one direction than the other. For instance, if we modified the line

                                                       Team LRN
                                                   Behavioral-based robotics, neural networks, nervous nets, and subsumption architecture
   203   204   205   206   207   208   209   210   211   212   213