November 2018
Beginner
472 pages
13h 5m
English
Now that we have tested both sensors, it's time to integrate our new sensors with our robot class, and then create an obstacle avoidance behavior for them. We've seen how to write line sensor code that was event-based. For this sensor, we will use a different style, that is, polling. Our behavior loop will read the sensors, and then choose behavior accordingly. For the most part, the way the code will react to things does not change, and it is a decision about where to put the loop for checking sensor state—in the sensor object, or in your own code.
Read now
Unlock full access