Robotics with the Boe-Bot text v2.2
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 value of m and b in this line of code from 
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 
GOSUB 
Test_Photoresistors and GOSUB Average_And_Difference. Your m value 
will replace 351 and your b value will replace 7. 
' Robotics with the Boe-Bot - BalancePhotoresistors.bs2 
' Test adjustments to Boe-Bot photoresistor circuits. 
' {$STAMP BS2} ' Stamp directive. 
' {$PBASIC 2.5} ' PBASIC directive. 
timeLeft VAR Word ' Variable declarations. 
timeRight VAR Word 
DEBUG "PHOTORESISTOR VALUES", CR, ' Initialization. 
 "timeLeft timeRight", CR, 
 "-------- ---------" 
DO ' Main routine. 
 HIGH 6 ' Left RC time measurement. 
 PAUSE 3 
 RCTIME 6,1,timeLeft 
 HIGH 3 ' Right RC time measurement. 
 PAUSE 3 
 RCTIME 3,1,timeRight 
 DEBUG CRSRXY, 0, 3, ' Display measurements. 
 DEC5 timeLeft, 
 " ", 










