130-28029 Parallax Inc, 130-28029 Datasheet - Page 59

KIT PARTS SMART SENSORS

130-28029

Manufacturer Part Number
130-28029
Description
KIT PARTS SMART SENSORS
Manufacturer
Parallax Inc
Datasheet

Specifications of 130-28029

Accessory Type
Education Kit
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
BASIC Stamp®
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
The speed of sound in air at room temperature 72 °F (22.2 °C) is 344.8 m/s. Dividing
10,000 into this leaves us with S
The BASIC Stamp can use the
command’s
if the
will store the centimeter distance result in the
With the
0.03448. Instead of a decimal denominator, like 10,000 (in the case of 0.03448), the
operator needs a value that would go in the numerator of a fraction with a denominator of
65536. To get that numerator, multiply your fractional value by 65536.
Now, we've got the value we need to modify PingTest.bs2 so that it will measure
centimeter distance. We'll also add a variable to store distance (
the constant to store the value 2260 (
Then, the
centimeter measurement. The
display the measurement.
PULSIN
cmDistance = CmConstant ** time
CmConstant
cmDistance
cmDistance = CmConstant ** time
DEBUG HOME, DEC3 cmDistance, " cm"
S
CmCons
**
object-
**
Duration
operator,
command stores the echo measurement in the
calculation can be added to the PingText.bs2's
cm
tan
=
=
t
0.03448
CON
VAR
344.8
=
CmConstant
measurement by a fractional value that's less than 1. For example,
0.0344
10,000
2260
Word
t
PULSIN
t
DEBUG
**
object-cm
PULSIN
8
×
operator to multiply a variable that stores the
65536
will have to be 2260, which is the
CmConstant
-
BS2
-
command in the program can then be modified to
= 0.03448 t
BS2
=
cmDistance
2260
Chapter 2: The Ping))) Ultrasonic Sensor · Page 47
).
PULSIN-BS2
variable:
.
time
DO
cmDistance
...
variable, this command
LOOP
**
to calculate the
equivalent of
) along with
PULSIN
**

Related parts for 130-28029