Switches and push buttons need debouncing. It is straightforward to do this with software, using a library. The advantages of the Switch library are: External pull-up resistors are not required.