For people new to using the Arduino IDE with various hardware, it might be worth pointing out that while a pullup is needed, and the Atmega328 has internal pullups when configured with INPUT_PULLUP, ...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
If you want a button or switch as an input on a microcontroller (MCU), you can use a “pullup resistor” so that the input is seen as a logical high when the (normally open) switch or button is closed.