Page 326 · Robotics with the Boe-Bot
√
Calculate the values of m you will use with the */ operator by multiplying m by
256.
√
Substitute
your
BalancePhtoresistors.bs2:
timeLeft = (timeLeft */ 351) + 7
√
Enter, save, and run your adjusted version of BalancePhotoresistors.bs2.
√
Expose both photoresistors to the same light level.
√
Verify that the "after" values are similar and corrected for differences in the
"before" values.
√
Choose a different light level and again, expose both photoresistors to it.
√
Check the "after" values again for similarity.
√
When you have determined your values for m and b, you can modify
RoamingTowardTheLight.bs2 by uncommenting the equation between
Test_Photoresistors
will replace
351
' Robotics with the Boe-Bot - BalancePhotoresistors.bs2
' Test adjustments to Boe-Bot photoresistor circuits.
' {$STAMP BS2}
' {$PBASIC 2.5}
timeLeft
VAR
timeRight
VAR
DEBUG "PHOTORESISTOR VALUES", CR,
"timeLeft
timeRight", CR,
"--------
---------"
DO
HIGH 6
PAUSE 3
RCTIME 6,1,timeLeft
HIGH 3
PAUSE 3
RCTIME 3,1,timeRight
DEBUG CRSRXY, 0, 3,
DEC5 timeLeft,
"
",
value
of
m and
and
GOSUB Average_And_Difference
and your b value will replace
Word
Word
b
in
this
line of
. Your m value
.
7
' Stamp directive.
' PBASIC directive.
' Variable declarations.
' Initialization.
' Main routine.
' Left RC time measurement.
' Right RC time measurement.
' Display measurements.
code
from
GOSUB
Need help?
Do you have a question about the Boe-Bot and is the answer not in the manual?
Questions and answers