27403 Parallax Inc, 27403 Datasheet - Page 84

GUIDE APP ROBOTCS W/SUMOBOT V1.0

27403

Manufacturer Part Number
27403
Description
GUIDE APP ROBOTCS W/SUMOBOT V1.0
Manufacturer
Parallax Inc
Datasheet

Specifications of 27403

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
If the IR receiver is sending 5 V to P11, it means it doesn't see any reflected infrared. If
this is the case, the BASIC Stamp stores the value 1 in the P11 input register bit
the IR receiver does detect infrared reflected off some object, it will send 0 V to P11.
While P11 senses 0 V,
V for a fraction of a millisecond after the
receiver's output rebounds to 5 V,
= IN11
return to 1 by the time the next PBASIC command gets executed, the value 0 gets safely
stored in the
it.
A more formal way to write the IR detection routine is to use a
P11 a name like
can give P4 a name, like
front. You can then use these pin names in place of the 4 and the
the value 38500 a constant name, like
The
uses the same I/O pin in 20 different places. What if you disconnect the circuit from the
I/O pin you were using and connect it to a different I/O pin? Instead of replacing 20
different references to the I/O pin, simply update the number in the
the program is fixed. Another
looks at each command and decides whether you are using the I/O pin as an output or an
input.
PIN
IrLedLF
IrSenseLF
IrFreq
irLF
FREQOUT IrLedLF, 1, IrFreq
irLF = IrSenseLF
must come immediately after the
directive has lots of advantages. For example, imagine you have a program that
.
.
.
.
.
.
.
.
.
irLF
irSenseLF
(short for infrared-left-front) variable for as long as the program needs
IN11
PIN
PIN
CON
VAR
IrLedLF
, which stands for infrared-sensor-left-front. Likewise, you
stores a 0. The problem is, the IR receiver only sends that 0
PIN
4
11
38500
Bit
IN11
, which is short for infrared-light-emitting-diode-left-
directive advantage is that the BASIC Stamp Editor
IrFreq
stores a 1 again. That's why the command
FREQOUT
. Your code will then look like this:
FREQOUT
command. Even though
command stops. After the IR
PIN
IN11
PIN
directive, and give
. In addition, give
directive, and
IN11
IN11
irLF
will
. If

Related parts for 27403