Closed elrdi closed 4 years ago
The PulseIn
function returns a time in microseconds, and since sound travels at approximately 29cm / microsecond, we can figure out a distance. The distance returned would be the distance the sound traveled (to the object and back), so we will have to also divide the distance by two: returnTime / 29 / 2 (or returnTime / 58 to simplify it)
thanks !!
First of all, thank you for the content. I have a question about the line 50, in which you wrote the following instruction : distance = distance / 58 ; Where did this 58 come from? I really wanna know. And once more , thank you !