Chapter 8: Robot Control with Distance Detection · Page 295
4. What PBASIC directive do you use to declare a constant? How would you give
the number 100 the name “BoilingPoint”?
Exercises
1. List the sensitivity of the IR detector for each kHz frequency shown in Figure 8-
1.
2. Write a segment of code that does the frequency sweep for just four frequencies
instead of five.
3. Make a condensed checklist for the tests that should be performed to ensure
faithful stripe following.
Projects
P1. Create different types of electrical tape intersections and program the Boe-Bot to
navigate through them. The intersections could be 90° left, 90° right, three-way,
and four-way. This will involve the Boe-Bot recognizing it is at an intersection.
When the Boe-Bot executes StripeFollowingBoeBot.bs2, the Boe-Bot will stay
still at intersections. The goal is to have the Boe-Bot realize it’s not doing
anything and break from its proportional control loop.
Hints: You can do this by creating two counters, one that increments by 1 each
time through the
DO…LOOP, and the other that only increments when the Boe-Bot
delivers a forward pulse. When the counter that increments each time through the
DO…LOOP gets to 60, use IF…THEN to check how many forward pulses were
applied. If less than 30 forward pulses were applied, the Boe-Bot is probably
stuck. Remember to reset both counters to zero each time the loop counter gets
to 60. After the Boe-Bot recognizes that it is at an intersection, it needs to move
to the top edge of the intersection, then back up and figure out whether it sees
electrical tape or white background on the left and right, then make the correct
90° turn. Use a preprogrammed motion for turning 90°, without proportional
control. For three-way and four-way intersections, the Boe-Bot may turn either
right or left.
P2. Advanced Project - Design a maze-solving contest of your own, and program the
Boe-Bot to solve it!