Question about pulseIn

You need to debounce your button take a look at debouncing in the playground section.

Mark