Starting an entire subroutine with a single momentary button press

I am trying to run a subprogram whenever the button is depressed.

The program is working correctly, according to that specification.

However, if you want the function to be executed only once per button press, you have to wait until the button is pressed, then released before calling that function. You may need to debounce the button.