28125 Parallax Inc, 28125 Datasheet - Page 186

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
Example Program: TestWhiskers.bs2
This next example program is designed to test the whiskers to make sure they are
functioning properly. By displaying the binary digits stored in the P7 and P5 input
registers (
contact with a whisker. When the value stored in a given input register is 1, the whisker
is not pressed. When it is 0, the whisker is pressed.
' Robotics with the Boe-Bot - TestWhiskers.bs2
' Display what the I/O pins connected to the whiskers sense.
' {$STAMP BS2}
Reconnect power to your board and servos.
Enter, save, and run TestWhiskers.bs2.
This program makes use of the Debug Terminal, so leave the serial cable
connected to the BASIC Stamp while the program is running.
IN7
How do you get the BASIC Stamp to tell you whether it’s reading a 1 or 0? Because
the circuit is connected to P7, this 1 or 0 value will appear in a variable named
called an input register. Input register variables are built-in and do not have to be declared in
the beginning of your program. You can see the value this variable is storing by using the
command
display one binary digit (either 1 or 0).
and
IN5
DEBUG BIN1 IN7
), the program will show you whether the BASIC Stamp detects
. The
BIN1
is a formatter that tells the Debug Terminal to
' Stamp directive.
Figure 5-8
Detecting Electrical
Contacts
IN7
.
IN7
is

Related parts for 28125