Figure 10.
Figure 9.
Once you get that working, you can change the first
part of the program to walk in any pattern you like. Of
course, any good robot needs sensors, input, and a
‘behavior.’ It’s shamefully easy to make our robot into a
light seeker.
Remember the two-photocell differential light sensor? It
outputs a value to the ADC indicating where the brighter
light is. Above 127 means left and below 127 means right.
With that, I leave you to rule your robot with a
flashlight. Play around and see what else you can do. You
could make it IR remote controlled with the info from Part
2. You could add the Sharp distance sensor on top and
make a gesture-controlled robot, as I did on another robot
( www.youtube.com/watch?v=5rcjZZreLFY).
You could add a thermistor so he walks left or right
depending on the temperature ... okay, maybe not.
Since our walker rotates as it walks, the values are always
changing — even when it’s generally headed straight for a
bright light.
Whatever you decide, you are now officially a roboticist
and therefore a little dangerous. What will you do next?
SV
So, our whole program is: If the light is on the left,
step right, and vice versa. It works surprisingly well (check it
out at www.youtube.com/watch?v=4CaAq6gQbLY):
do ‘ start DO loop
readadc c.2,b1 ‘ get light sensor value
sertxd(#b1,13,10) ‘ send reading to
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘ display
if b1<127 then gosub right ‘ light left to step
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘right
if b1>127 then gosub left ‘ light right so
‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘‘ step left
loop ‘ end DO loop
right: (include right subroutine from above)
left: (include left subroutine from above)
SERVO 11.2015 73