Page 228 ·
Robotics with the Boe-Bot
2.
Does an I/O pin have any effect on the circuit when it’s set to input? What
causes the input register for an I/O pin to hold a 1 or 0 when it’s set to input?
3.
What does threshold voltage mean? What’s the threshold voltage of a BASIC
Stamp I/O pin?
4.
Referring to Figure 6-4 on page 197, what causes Vo to rise above or fall below
a BASIC Stamp I/O pin’s threshold voltage? What is it about the circuit that
causes Vo to change value?
5.
How does the program ShadowGuidedBoeBot.bs2 differ from the program
RoamingWithPhotoresistorDividers.bs2? What does this change in the Boe-
Bot’s performance?
6.
What is a constant declaration? What does it do? How can you use one in a
program?
7.
How are math expressions evaluated in PBASIC?
8.
What are the two examples in this chapter where PBASIC was used to calculate
an average? How are they different? How are they the same?
Exercises
1.
Calculate Vo for Figure 6-4 on page 197 if R is 10 k
Ω
. Repeat for R = 30 k
Ω
.
2.
If Vo in Figure 6-4 on page 197 is 1.4 V, what’s the value of R? Repeat for Vo
= 1 V and Vo = 3 V.
3.
Assume you have three variable values:
firstValue
,
secondValue
, and
thirdValue
. Write a command that takes the average of these three values in a
variable named
myAverage
. Write a command that stores 7/8 of the average
value in a variable named
myScaledAverage
. Write the variable declarations
needed to make your command able to run in a program, first with
myAverage
and
myScaledAverage
as separate variables, then with one of these variable
names aliased as the other.
Projects
1.
With your Boe-Bot’s photoresistors looking down in front of it, develop a
program that makes your Boe-Bot recognize the difference between black and
white. Find a large white surface and place dark-black sheets of paper on it.
Develop a program that makes the Boe-Bot avoid the black sheets of paper.
Hints: Make sure to test and understand what the Boe-Bot sees when it is
focused on a black sheet of paper and what it sees when it is focused on a white
background. Use example programs from the last three activities in this chapter.
The RC decay time circuit and programs will be much more helpful for making