I think you are looking for something like:
https://forum.arduino.cc/t/waiting-for-user-input/311750/6