Question about not having an external resistor in "Button" example

I have a question about how the "Button" example is wired. (Link here:

In the example, a 10k ohm resister is added as a pull down (or pull up if wired slightly differently) resistor. I note in other documentation that a 20k pull up resistor is built into the Atmega chip that can be turned on by issuing a digitalWrite(pin, HIGH) command after setting a pin to input.

Does this mean the circuit in the example (if reversed so the 10k resister is used as a pull up resistor) could be simplified by simply turning on the internal 20k pull up resistor and wiring GND to the button and then directly to pin 2 without an external resistor?

Just seeking clarification that I'm understanding things correctly. Thanks.

yes, In fact I preach using the internal pull up, it uses 1 less part and the logic is not inverted (ie the button is up, arduino reads high, the button is down, arduino reads low)

Many examples with buttons use the internal pull-up resistor.

But it's not 20k, it could be 60k or higher. So it's a weak pull-up. Just touching the circuit could be enough to get a false reading. So to avoid problems a (normal) pull-up resistor of 10k is often added.

Ok, thanks for the information everyone. I think the internal would work for me, but I'll make sure it's reliable for my purposes.

For the atmega328p in the Uno, the datasheet gives the pullup resistor value as 20K to 50K for the I/O pins and 30K to 60K for the reset pin. These pullups are adequate if the wire between button and Arduino pin is reasonably short and not in the same bundle as other wires carrying output signals. Even if the pin does pick up some noise from output lines, if you are using debouncing software when you read the pin, then that will normally suppress the noise anyway.

dc42: For the atmega328p in the Uno, the datasheet gives the pullup resistor value as 20K to 50K ...

You are right, it is 20k to 50k for normal I/O pins on the ATmega328P according to the datasheet. I had a pull-up that was more than 50k once, but it was on an other AVR chip, not the ATmega328P.