27404 Parallax Inc, 27404 Datasheet - Page 98

COMPETITION RING FOR SUMOBOT

27404

Manufacturer Part Number
27404
Description
COMPETITION RING FOR SUMOBOT
Manufacturer
Parallax Inc
Datasheet

Specifications of 27404

Accessory Type
Hobby and Education
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
' -----[ Initialization ]-----------------------------------------------------
DEBUG CLS, "FRONT IR DETECTORS", CR,
' -----[ Main Routine ]-------------------------------------------------------
FOR frequency = 36000 TO 42000 STEP 500
NEXT
Your Turn - Frequency Constants
Sometimes it is useful to “comment-out” a line of code in your program by placing an
apostrophe to the left of it, effectively removing it from your executable code without
removing it from your program. It's a good idea to keep some commented-out
constants along with the one you use regularly, as in the example below. That way, you
can comment and uncomment various constants depending on what environment you are
testing in. For example, when prototyping maneuvers, it's better to make your SumoBot
nearsighted so that it only detects an object when you place your hand close to the sensor
you want to detect an object. Medium range might work better for a competition ring in
tight quarters, and maximum range might work better for a competition ring in a spacious
area.
' -----[ Constants ]----------------------------------------------------------
IrFreq
' IrFreq
' IrFreq
FREQOUT IrLedLF, 1, frequency
irLF = ~IrSenseLF
FREQOUT IrLedRF, 1, frequency
irRF = ~IrSenseRF
DEBUG CR, DEC frequency, CRSRX, 11
IF irLF = 1 THEN DEBUG "yes" ELSE DEBUG "no"
DEBUG CRSRX, 19
IF irRF = 1 THEN DEBUG "yes" ELSE DEBUG "no"
PAUSE 50
"Frequency Left
"--------- ----
CON
CON
CON
39500
38500
41500
Right", CR,
-----", CR
' Display heading
' Left IRLED shines IR light
' Save IR receiver output
' Repeat for right IRLED/receiver
' Display yes/no for detection
' Delay for slower PCs
' Maximum range
' Medium range
' Close range
IrFreq

Related parts for 27404