This may sound silly but I need to know before frying my board.
Why would I use a resistor for the example on page 31 of Arduino_booklet02.pdf?
In the previous example (blinking LED) there was no resistor.
Correct me but the current runs through the resistor and back into the board (7) but not passing through the switch till activated. When activated the current is returned to ground simultaneously to (7). Without the resistor would I burnout the board or the switch.
Can someone explain this?
The resistor in this case is called a “pull up” resistor. When you configure a pin to a microcontroller (or, almost any modern digital logic chip) as an input, it is not a good idea to leave it unconnected to anything. These inputs are essentially a capacitor, and there’s a danger that they can pick up a partial charge that causes them to ‘float’ to a voltage level that is not legal for a digital input. This can cause problems ranging from inconsistent input values, excessive power consumption, and even (in extreme cases) damage to the chip.
In the circuit you are referring to, when the button is not pushed, the resistor connects the logic input to +5V; a nice solid “1” input. When you DO push the button, the button provides a much lower resistance path to ground for the input, and it reads a nice solid zero. If you replaced the resistor with a plain wire, you would short out the supply through the switch and wire, and possibly burn something out (as you say.) (when the resistor is in the circuit, it limits the current to a value that is safe for the switch, the wire, and itself.)
Easiest just to read LadyAda’s latest tutorial. It goes in to this indepth.
Thanks you guys.
I did not think I would get such great responses.
Thanks a bunch.