28029 Parallax Inc, 28029 Datasheet - Page 62

KIT PARTS SMART SENSORS W/TEXT

28029

Manufacturer Part Number
28029
Description
KIT PARTS SMART SENSORS W/TEXT
Manufacturer
Parallax Inc
Datasheet

Specifications of 28029

Accessory Type
Parts Kit
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
BASIC Stamp® or Javelin Modules
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Other names
28029PAR
Page 50 · Smart Sensors and Applications
Example Program: PingMeasureCmAndIn.bs2
' Smart Sensors and Applications - PingMeasureCmAndIn.bs2
' Measure distance with Ping))) sensor and display in both in & cm
' {$STAMP BS2}
' {$PBASIC 2.5}
' Conversion constants for room temperature measurements.
CmConstant
InConstant
cmDistance
inDistance
time
DO
LOOP
Your Turn
PULSOUT 15, 5
PULSIN 15, 1, time
cmDistance = cmConstant ** time
inDistance = inConstant ** time
DEBUG HOME, DEC3 cmDistance, " cm"
DEBUG CR, DEC3 inDistance, " in"
PAUSE 100
Enter, save, and run PingMeasureCmAndIn.bs2.
Experiment with the distance measurements and verify that they are correct in
both systems.
There are 12 inches in 1 foot. Modify the program so that it displays feet and
inches. Hint: After calculating
of feet, and
There are 10 centimeters in a decimeter. Repeat for decimeters and centimeters.
CON
CON
VAR
VAR
VAR
2260
890
Word
Word
Word
// 12
to find the remainder in inches.
inDistance
, use
/ 12
to figure out the number

Related parts for 28029