Parallax Boe-Bot Student Manual page 239

Hide thumbs Also See for Boe-Bot:
Table of Contents

Advertisement

Instead of the value 6, try dividing the
and 9.
Run the program and test the Boe-Bot's ability to exit a dark room with each
denominator value.
Decide what the optimum denominator value is.
Average_And_Difference:
average = timeRight + timeLeft / 2
difference = average / 6
RETURN
You can also change the denominator into a constant like this:
Denominator CON 6
Then, in your Average_And_Difference subroutine, you can replace 6 (or the optimum
value that you determined) with the
Average_And_Difference:
average = timeRight + timeLeft / 2
difference = average / Denominator
RETURN
Make the changes just discussed, and verify that the program still works
correctly.
You can also use one less variable in this program. Notice that the only time the
variable is used is to temporarily hold the average value, then it gets divided by
average
and stored in the
Denominator
needed later, but the
average
simply use the
difference
and you would no longer need the
look:
Average_And_Difference:
difference = timeRight + timeLeft / 2
Chapter 6: Light Sensitive Navigation with Photoresistors · Page 225
average
constant, like this:
Denominator
variable. The
difference
variable is not. One way to fix this problem would be to
variable in place of the
average
variable. Here is how the subroutine would
average
variable by the values 3, 4, 5, 7,
variable is
difference
variable. It will work fine,

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Boe-Bot and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF