28125 Parallax Inc, 28125 Datasheet - Page 246

TEXT ROBOTICS

28125

Manufacturer Part Number
28125
Description
TEXT ROBOTICS
Manufacturer
Parallax Inc
Datasheet

Specifications of 28125

Title
Robotics with the Boe-Bot
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
' -----[ 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
RightWhite
LeftBlack
RightBlack
LeftAvg
RightAvg
' -----[ Variables ]------------------------------------------------------
timeLeft
timeRight
' -----[ Main Routine ]---------------------------------------------------
DO
LOOP
' -----[ Subroutine - Test_Photoresistors ]-------------------------------
Test_Photoresistors:
RETURN
GOSUB Test_Photoresistors
IF (timeLeft > LeftAvg) THEN
ELSE
ENDIF
IF (timeRight > RightAvg) THEN
ELSE
ENDIF
HIGH 6
PAUSE 3
RCTIME 6,1,timeLeft
HIGH 3
PAUSE 3
RCTIME 3,1,timeRight
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
DEBUG CRSRXY, 0, 0, "Left Black
DEBUG CRSRXY, 0, 0, "Left White
DEBUG CRSRXY, 13, 0, "Right Black", CR
DEBUG CRSRXY, 13, 0, "Right White", CR
CON
CON
CON
CON
CON
CON
VAR
VAR
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.

Related parts for 28125