pull down resistor

hey,

question about a pull down resistor circuit out of a book.

the circuit goes like this:

5v -> switch -> direction 1 or 2

direction 1) 150 ohm resistor -> ground
direction 2) -> pin 2 arduino

now my question:

when the switch is pushed the current goes from my 5 v source over the switch to pin2 on the arduino (less resistance). but because there is no resistor between switch en pin2 don't i make short circuit? or damage may arduino?

Yes - normally the resistor would be 1k to 10k or so to reduce the current when the switch is on. When the switch is off the resistor pulls the input to LOW, when the switch is on (since its resistance will be much less than the resistor, a fraction of an ohm) the switch pulls the pin up to HIGH.

The Arduino pins have built-in pull-up resistors which can be used to avoid needing actual separate resistors. Because they are pull-ups you then wire the switch to ground, not +5V, and reverse the logic of the test in the code.

el_sleepy:
hey,

question about a pull down resistor circuit out of a book.

the circuit goes like this:

5v -> switch -> direction 1 or 2

direction 1) 150 ohm resistor -> ground
direction 2) -> pin 2 arduino

now my question:

when the switch is pushed the current goes from my 5 v source over the switch to pin2 on the arduino (less resistance). but because there is no resistor between switch en pin2 don't i make short circuit? or damage may arduino?

While I don't see a possible damage route, I don't think you have it wired correctly. A wiring diagram is also better to show what you have or plan on trying.

First by 2 direction switch do you mean you have a SPDT switch? Also the pull down resistor should be wired such that it is always connected to the arduino input pin, otherwise you will still have a 'floating input pin' condition. Also 150 ohm resistor is too small for a pull-down application as it wastes too much current, 10k ohms would be much better.

Lefty