While button is held, output another pin as high- up to a maximum time length

dougp:
The first thing to get down is sensing when [color=blue]proxPin[/color] changes . In the IDE refer to: file/examples/digital/state change detection.

Next, set the timer up as free-running, that is, it increments continuously. When timer is done, that is, reaches preset, use that condition to shut off the pump.

Finally, reset the timer - [color=blue]currentMillis = millis()[/color] - when the state of [color=blue]proxPinChanged[/color] goes high. [color=blue]proxPinChanged[/color] will be high for only one pass through the program each time the sensor is triggered.

So, as long as pulses are arriving at a certain rate the timer will never time out, keeping the pump on. If pulses cease the pump will shut off after X time.

These are good points. I had not heard of the state change detection before but it looks promising. I will play with it. Thanks for the response