122-27400 Parallax Inc, 122-27400 Datasheet - Page 37

MANUAL FOR SUMOBOT

122-27400

Manufacturer Part Number
122-27400
Description
MANUAL FOR SUMOBOT
Manufacturer
Parallax Inc
Datasheet

Specifications of 122-27400

Accessory Type
Manual
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
SumoBot®
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
lbLeft
lbRight
' -----[ Program Code ]----------------------------------------------------
Main:
' -----[ Subroutines ]-----------------------------------------------------
Read_Line_Sensors:
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.
GOSUB Read_Line_Sensors
DEBUG HOME, "LR", CR,
SELECT lineBits
ENDSELECT
GOTO Main
END
HIGH LLinePwr
HIGH RLinePwr
HIGH LLineIn
HIGH RLineIn
PAUSE 1
RCTIME LLineIn, 1, lLine
RCTIME RLineIn, 1, rLine
LOW LLinePwr
LOW RLinePwr
' convert readings to bits
LOOKDOWN lLine, >=[1000, 0], lbLeft
LOOKDOWN rLine, >=[1000, 0], lbRight
RETURN
CASE %00
CASE %01
CASE %10
CASE %11
DEBUG "Continue forward", CLREOL
DEBUG "Spin Left", CLREOL
DEBUG "Spin Right", CLREOL
DEBUG "Back up and turn around", CLREOL
BIN2 lineBits, CR, CR
VAR
VAR
lineBits.BIT1
lineBits.BIT0
Chapter 3: SumoBot Sensors and Border Detection · Page 27
' show sensor readings
' display actions
' activate sensors
' discharge caps
' read left sensor
' read right sensor
' deactivate sensors
' 0 = black, 1 = line

Related parts for 122-27400