needs a note to use a digital pin on the Arduino Mega instead of pin 7 as shown in the example. Pin 7 on a Mega is an "analog in" pin and the example code does not work using pin 7 on the Mega.
There are two pins 7s on the Mega. One of them is an analog pin, and won't work with pulseIn.
The other one is a digital pin, and will work with pulseIn.
I agree that the pulseIn page should probably clearly indicate that it only works with digital pins, however it does talk about HIGH and LOW which are digital pin terms.