EasyManuals Logo

Parallax Boe-Bot Assembly

Parallax Boe-Bot
78 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 #37 background imageLoading...
Page #37 background image
Chapter 3: SumoBot Sensors and Border Detection · Page 27
lbLeft VAR lineBits.BIT1
lbRight VAR lineBits.BIT0
' -----[ Program Code ]----------------------------------------------------
Main:
GOSUB Read_Line_Sensors
DEBUG HOME, "LR", CR, ' show sensor readings
BIN2 lineBits, CR, CR
SELECT lineBits ' display actions
CASE %00
DEBUG "Continue forward", CLREOL
CASE %01
DEBUG "Spin Left", CLREOL
CASE %10
DEBUG "Spin Right", CLREOL
CASE %11
DEBUG "Back up and turn around", CLREOL
ENDSELECT
GOTO Main
END
' -----[ Subroutines ]-----------------------------------------------------
Read_Line_Sensors:
HIGH LLinePwr ' activate sensors
HIGH RLinePwr
HIGH LLineIn ' discharge caps
HIGH RLineIn
PAUSE 1
RCTIME LLineIn, 1, lLine ' read left sensor
RCTIME RLineIn, 1, rLine ' read right sensor
LOW LLinePwr ' deactivate sensors
LOW RLinePwr
' convert readings to bits
LOOKDOWN lLine, >=[1000, 0], lbLeft ' 0 = black, 1 = line
LOOKDOWN rLine, >=[1000, 0], lbRight
RETURN
HOW IT WORKS
This program takes the working QTI code and incorporates into a unified subroutine.
The end of the subroutine converts the analog values from the QTI sensors to a single
nibble value that contains the status of both sensors. Incorporating both sensor readings
into a single variable streamlines the SumoBot robot's border avoidance logic.

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