This circuit below and the attached programs provide distance measurements that are better than the examples in Robotics with the Boe-Bot, Chapter 8. The measurements split a one foot (approx) distance into eight zones that are pretty evenly spaced, and there's next to no jitter in the measurements.