Many thanks for taking your time in writing it -- I think it is a great tutorial, very well present and well explained. ( I am sure there are many more readers of this text than commenters -- I, for one thing, registered on these forums just to let you know how good your tutorial is ) )
I would probably add here for those interested that in my experiments the measurements were showing a significant amount of jitter, so it may make sense to average them over a train of ~20-30 samples or so ( depending on the range of distances one wants to measure ).
Also, it may worth noting that the speed of the sound in the air would depend on several conditions, air temperature being one of them:
therefore, one may want to adjust the constant used in the code according to expected temperature of the air -- or may be tinker with other modules to experiment with air temperature readings, etc )