EasyManuals Logo

Parallax Boe-Bot User Manual

Parallax Boe-Bot
360 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #239 background imageLoading...
Page #239 background image
Chapter 6: Light Sensitive Navigation with Photoresistors · Page 225
Instead of the value 6, try dividing the average variable by the values 3, 4, 5, 7,
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
Denominator constant, like this:
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
average variable is used is to temporarily hold the average value, then it gets divided by
Denominator and stored in the difference variable. The difference variable is
needed later, but the
average variable is not. One way to fix this problem would be to
simply use the
difference variable in place of the average variable. It will work fine,
and you would no longer need the
average variable. Here is how the subroutine would
look:
Average_And_Difference:
difference = timeRight + timeLeft / 2

Table of Contents

Other manuals for Parallax Boe-Bot

Questions and Answers:

Question and Answer IconNeed help?

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

Parallax Boe-Bot Specifications

General IconGeneral
BrandParallax
ModelBoe-Bot
CategoryRobotics
LanguageEnglish