Pull up\Down resistor in the Arduino?

Hello
I want to know if it is possible to make this:
I want to connect a reset button(with 2 legs) to a digital input
so when I press it I will get "0"(GND) and in normal state is will be "1"(5V) ( I don't care if it the other way around...normally "0" and in press I get "1")

how do I do this?
and do I config the digital input to do this?

Thank ,

Pull it high or low, your choice (so you take a 10k to gnd to pin2) take a button sit one side with your arduino sharing pin2 with the 10k.

Place a 300ohm resistor from 5v+ to the other side of your button, this keeps pin2 from reading a float state and it will only read high when pushed.

300 ohms is rather low for a pull-up or pull-down.

The simplest method, assuming an Uno or Mega or other Arduino that supports it (ATmega processor),
is to go

  pinMode (pin, INPUT_PULLUP) ;

And simply connect the button between pin and ground. This enables an internal pull-up
resistor of about 30k. For a remote button with long cable (and hence risk of noise pick-up)
a lower pull-up resistor value would be wise, 4k7 or 2k2 would be adequate in most circumstances

MarkT:
300 ohms is rather low for a pull-up or pull-down.

The simplest method, assuming an Uno or Mega or other Arduino that supports it (ATmega processor),
is to go

  pinMode (pin, INPUT_PULLUP) ;

And simply connect the button between pin and ground. This enables an internal pull-up
resistor of about 30k. For a remote button with long cable (and hence risk of noise pick-up)
a lower pull-up resistor value would be wise, 4k7 or 2k2 would be adequate in most circumstances

300ohm is not the pull down, the 10k is...

cjdelphi:
300ohm is not the pull down, the 10k is...

Care to explain exactly what you mean by this then:-

Place a 300ohm resistor from 5v+ to the other side of your button, this keeps pin2 from reading a float state and it will only read high when pushed.

I think the best way for me is to use "Internal pull-up resistor"

and config the input as -

pinMode (switchPin, INPUT_PULLUP);

I'm using Arduino Ethernet - no problem there right?

Grumpy_Mike:

cjdelphi:
300ohm is not the pull down, the 10k is...

Care to explain exactly what you mean by this then:-

Place a 300ohm resistor from 5v+ to the other side of your button, this keeps pin2 from reading a float state and it will only read high when pushed.

Where's the rest of my post? and just what precisely don't you understand?

cjdelphi:

Grumpy_Mike:

cjdelphi:
300ohm is not the pull down, the 10k is...

Care to explain exactly what you mean by this then:-

Place a 300ohm resistor from 5v+ to the other side of your button, this keeps pin2 from reading a float state and it will only read high when pushed.

Where's the rest of my post? and just what precisely don't you understand?

tell me if I'm wrong, but you suggest :

+5V -> R300 -> one button's side [button] other button's side -> Inout + 10KOhm -> GND ?
what is the R300 for ?

don't you think it's better this way :

Input internally pulled-up -> one button's side [button] other button's side -> GND ?

I’m using Arduino Ethernet - no problem there right?

No problem with that.

Where’s the rest of my post?

The rest of your post is fine, it describes what I would call a pull up or pull down.
However, the second bit, the one I quoted, does not seem to make sense. I have never come across using 2 resistors in a pull up/down situation. You seem to be suggesting that this second resistor goes from +5V to the “other” side of the button.
Assuming a pull up is fitted for the first part then this would appear to either in parallel with the pull up if one side (the input side) of the button is chosen. If the other side, the ground side of the button is chosen then this second resistor does nothing.

Please explain what this second resistor is all about. Maybe you could post a diagram of how this wiring should be.

For reference your full quote was:-

cjdelphi:
Pull it high or low, your choice (so you take a 10k to gnd to pin2) take a button sit one side with your arduino sharing pin2 with the 10k.

Place a 300ohm resistor from 5v+ to the other side of your button, this keeps pin2 from reading a float state and it will only read high when pushed.

cjdelphi:
Pull it high or low, your choice (so you take a 10k to gnd to pin2) take a button sit one side with your arduino sharing pin2 with the 10k.

Place a 300ohm resistor from 5v+ to the other side of your button, this keeps pin2 from reading a float state and it will only read high when pushed.

Read all my post again.

Gnd ~ [10k ~ Pin2] ~ button ~ 300 (or so or higher, 1k) ~ +

So from ground to button is the 10k (which pulls it low) and the button, where the resistor and button meet, pin 2 is connected comprende?..

on the other side of the button, you want the signal to go high, so i used a 300 ohm resistor to the + side so when the button is PRESSED, the 10k low gets overriden with the logic 5v high.

300 or 3k no difference really as the fet draws little current to indicate high, so really the resistor is there just to limit the current/short across the button.

look at my way sophisticated and professional drawing i attached :stuck_out_tongue_closed_eyes:

You’ll see in the OFF state which that is, 0v is seen by Arduino, when you press the button, 5V will be seen, now you get how it works?

modified with my work of art drawing.

Gnd ~ [10k ~ Pin2] ~ button ~ 300 (or so or higher, 1k) ~ +

OH come on cjdelphi even by your poor standards in electronics this is a pure nonsense.

I have yet to see a post where you actually give correct advice, that is not just copying advice given earlier in the thread. If you know so little about the subject as you seem to do then please stop giving advice to beginners, you are not helping.

For your education if you care to read it, which I doubt because you never seem to want to learn anything, that top resistor is not only totally redundant but it makes the noise margin on the input worse by preventing the full possible voltage swing. It will cause a potential divider action and depending on the values chosen from the range you recommend could result in it not working at all.

so omit the 300, I thought it was redundant i was just thinking about any possible shorts with the button..

so sue me, 1.1v produced as a voltage divider.. so wow, it's 2am and yes i was not thinking, but your constant dry humping is a little annoying, like a school child who just wont shut up, i'm experienced in many other fields and i've made no claims of being an expert here.... so really now stfu.

I, too, am trying to figure out what the 300 ohm resistor is for. I don't see it anywhere in your schematic, cjdelphi.

It isn't necessary to -say- you are an expert. If you -act- like an expert but give questionable or bad advice, you will mislead the very people who should not be misled - the newbies.

If you say questionable things, expect to be called on it. I expect it. I welcome it. If I'm wrong, I want it pointed out. I'll defend what I've said, or thank whomever for correcting me.

Unless I'm having a bad day... but I hope never to compare anyone to being dry humped by a school child. Ugh.

I think the question has been answered.

Thread locked.