Parallax Boe-Bot Student Manual page 246

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

Advertisement

Page 232 · Robotics with the Boe-Bot
' -----[ Title ]----------------------------------------------------------
' Robotics with the Boe-Bot - TestBlackWhiteLogic.bs2
' Calculate whether Boe-Bot is over black or white surface, and print.
' {$STAMP BS2}
' {$PBASIC 2.5}
' -----[ Constants ]------------------------------------------------------
LeftWhite
CON
RightWhite
CON
LeftBlack
CON
RightBlack
CON
LeftAvg
CON
RightAvg
CON
' -----[ Variables ]------------------------------------------------------
timeLeft
VAR
timeRight
VAR
' -----[ Main Routine ]---------------------------------------------------
DO
GOSUB Test_Photoresistors
IF (timeLeft > LeftAvg) THEN
DEBUG CRSRXY, 0, 0, "Left Black
ELSE
DEBUG CRSRXY, 0, 0, "Left White
ENDIF
IF (timeRight > RightAvg) THEN
DEBUG CRSRXY, 13, 0, "Right Black", CR
ELSE
DEBUG CRSRXY, 13, 0, "Right White", CR
ENDIF
LOOP
' -----[ Subroutine - Test_Photoresistors ]-------------------------------
Test_Photoresistors:
HIGH 6
PAUSE 3
RCTIME 6,1,timeLeft
HIGH 3
PAUSE 3
RCTIME 3,1,timeRight
RETURN
To develop a program that makes the Boe-Bot avoid the black sheets of paper,
the decision and navigation steps required are very similar to
16
33
26
45
LeftWhite + LeftBlack / 2
RightWhite + RightBlack / 2
Word
Word
"
"
' Stamp directive
' PBASIC directive.
' Left photoresistor reading
' Right photoresistor reading
' Left RC time Measurement.
' Right RC time measurement.

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?

Subscribe to Our Youtube Channel

Table of Contents

Save PDF