Arduino MEGA does reset when there is an input

HI my problem is very strange how I find, as first Project on my new Arduino I wanted to make an clock so I started with the display so far no pro. but then s i tried an button or a potenziometer as input my arduino did a reset. How comes it, how can i fix it an idea?? Thanks a lot for your help

You are probably shorting out the power pin to gnd. Your button should go from the pin to gnd, with the internal pullup resistor enabled. The pin will then read high when the button is not pressed, and low when pressed.

Same for the pot. One outer leg to +5, one outer leg to Gnd, wiper leg to analog input pin.