Datasheet
Chapter 1: Detect Distance with the Ping))) Ultrasonic Detector ยท Page 5
โ Save PingTest.bs2 as PingCentimeters.bs2.
โ Add the two new lines of code to the program's
DO...LOOP between the DEBUG and
PAUSE commands. When you're done, the DO...LOOP should look like this:
DO
PULSOUT 15, 5
PULSIN 15, 1, time
DEBUG HOME, "time = ", DEC5 time
time = time ** 2251
DEBUG CR, "Distance = ", DEC4 time, " cm"
PAUSE 100
LOOP
โ Run your modified program and verify that the program correctly displays both the
echo time and centimeter measurements.