Electronic – arduino’s pin number 7, isn’t it dangerous without resistor

arduinogroundshort-circuit

I am reading a book called Getting started with Arduino. In that book, I don't understand why there is no resistor between pin number 7 and the switch (see diagram:)

Arduino-breadboard diagram

If there is no resistor between power source and ground, wouldn't it be prone to short-circuit and cause damage? Does pin 7 contain a built-in resistor or something?

Best Answer

Your hypothesis is correct: in input mode, the pins have very high impedance, somewhere along the range of 10s of mega ohms. So there will be little current flowing into pin 7, and it is OK to use it as is. Note that pin 7 is NOT ground so there is no short circuit between power source and ground.

When you press the switch, current will flow primarily through the resistor. The voltage will rise and will be seen by pin 7 as a digital high.