From your diagram, when you press the button, you have the 5V from the power supply shorted to ground, which creates a short circuit, causing everything to not run if you don't a spark. The proper way to connect the button would be have the button connected between Vcc and one end of the resistor, with the other end of the resistor connected to ground. There should be another connection at the node of the resistor and button that connects to the input pin so that the microcontroller can detect the change in the voltage levels.