I am using multiple tactile buttons. Each is using a pull down resistor of 10K, and a 100ohm resistor going to the digital pin. This is the most common, and acceptable, configuration I have seen. What I am unsure of is why is the 100ohm resistor is used when 5V and 100ohm will send 50mA to the digital pin. I may be mistaken but I thought 40mA is the max to any digital pin. Also it has been acceptable to use 1/4W resistors. At 50mA this is the max rating for the resistor. Please correct me if I am looking at this wrong. Thank you!
You only need the 10k resistor.
Connect the Arduino pin to 5V using the resistor. Then use the push button to pull it to ground. Remember to set the pin as an input.
The logic in the sketch will be reversed. i.e. Low will mean 'on' and High will be 'off'.
The other way is to pull the pin to ground using the resistor and use the push button to pull it up to 5 v. The logic will not be reversed in this case.
pins set up as inputs are in a high impedance state, the 100 ohm really isnt even needed
This is the most common, and acceptable, configuration I have seen.
yea over the last few months it seems to be quite popular
Why? ... I dont know, new people do weird things, seems like a waste of hardware to assure that one doesnt have to actually know basic functions of software.
edit
actually the simplest way is to set your pin as input, digitalwrite it high, now its in high impedance state and uses an internal pullup resistor, connect button to pin, other side to ground, no resistors, and your logic isnt inverted from the physical state of the button (ie when the button is up the pin is high, when its down the pin is low)
jonatj89:
What I am unsure of is why is the 100ohm resistor is used when 5V and 100ohm will send 50mA to the digital pin.
Do you mean the pin is pulled to ground with 10K, and then connected to 5V via 100 ohm when pressed? That could send 50 mA but it won't because an input pin is high impedance. It would only be a problem if you configured the pin as output and set it low. In which case 100 ohms isn't really enough.
As Osgeld said, the simplest is to configure the internal pull-ups and manage without any resistors.