Introduction to Robotics/Printouts/Sound Waves

From testwiki
Jump to navigation Jump to search

Template:Introduction to Robotics/Page top

Speed of sound
D=Ct
D is the distance, measured in meters.
C is the speed of sound in air, measured in meters per second.
t is the amount of time the wave travels, measured in seconds.
At 72°, sound travels at 344.8m/s.
Convert to Centimeters
We convert to centimeters because they are more useful, and it helps to remove fractions from our calculation.
D=Ct×100cm1m=100Ct
For the BoeBot
D=100CT2
Because the sound wave must travel to the object and back.
The BoeBot measures t in "clock cycles", which are each 2μseconds. We must convert the equation to use seconds instead of clock cycles:
D=100Ct2×21,000,000=Ct10,000=0.03448t
Fractional Math
The BoeBot can do some limited math with fractions.
The "**" operator is used as follows:
A**B=A×B65536
We calculate that:
We can use the following code to convert time to distance:
Distance = Conversion ** time
Finding the Conversion Constant
Conversion=0.03448×65536=2260

Template:Introduction to Robotics/Page bottom