I want to have a momentary button and an LED on the same digital pin. What I want to be able to do is detect a press of the button and yet also periodically flash the LED for a short time.
The idea is that the pin is configured to be an input (with an internal pullup) most of the time. With the button open the LED will be off and the pin will read high. If the button is pressed the pin will read low (and the LED will turn on). Periodically, for a short period of time, the pin will be configured as an output and set to low. Then the LED will be on. If the button is pressed and released during this short time it would be missed.
Will it work? Is there a better way to do this?