Pages: [1]   Go Down
Author Topic: newbie question on resistors  (Read 297 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 :-[
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?
 
Thanks
Randy
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 106
Posts: 6373
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.)
Logged

Brisbane, Australia
Offline Offline
God Member
*****
Karma: 1
Posts: 593
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Easiest just to read LadyAda's latest tutorial. It goes in to this indepth. smiley-wink
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 smiley-grin

Thanks you guys.
I did not think I would get such great responses.

Thanks a bunch.
Randy
Logged

Pages: [1]   Go Up
Jump to: