• avoid() is the highest-level behavior. It is triggered by the bumpers and does the standard back-up-and-turn.
Convincing Hank to seek light is surprisingly hard. You can, of course, implement your own algorithm in seek_enlightenment(). It's a neat feature of subsumption architecture that you can
concentrate solely on light-seeking behavior in seek_enlightenment(). The obstacle avoidance behavior is already programmed in a different behavior and will subsume the light-seeking
behavior as necessary.
Without further ado, here's the entire program, LightSeeker.c:
Need help?
Do you have a question about the MINDSTORMS Robots and is the answer not in the manual?
Questions and answers