Sign up ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

I'm beginning with electronics and don't have all the good reflexes yet. So here is my question:

Can I do what I did here?

can i do this

Do I have to add diodes between the Nano +5V and the junction point?

My goal is to have one button's state read by 2 Arduino Nano.

share|improve this question
1  
Providing the 5V to the button should be coming from just 1 arduino. And you can also use the internal pull-up resistor from the arduino. That way you'll only need to connect one side of the button to the ground and the other side of the button to the 2 input pins of the arduino. To use the internal pull-up use pinMode(pin, INPUT_PULLUP); – Handoko Jun 10 '14 at 10:46
    
Question is: why do you want two arduinos to do exactly the same? Maybe we could get rid of the second one altogether :) – Tom Jun 13 '14 at 14:24

1 Answer 1

up vote 7 down vote accepted

You don't need to add anymore components to your schematic. But you can leave some components.

Before you're adding a button to your schematic please consider first how you want to detect your signal. A logic 1 as if a button is pressed? Or logic 0 as if a button is pressed. You can do this using pull-up and pull-down resistors. These resistors should be wired like this.

pull resistor

(The 100Ohm resistor in an internal resistor from the MCU)

Using the pull-down resistor means that when the button is pressed you'd get a logic 1. Using pull-up resistors means that when the button is pressed you'd get a logic 0.

When I see your schematic it seems like you're trying to make a pushbutton with pull-down resistor. Then you should wire your arduino like this.

pull-down button

Another option is to use the Arduino internal pull-up resistors. That way you don't have to add the 10k resistor in your schematic. And your schematic will look like this.

internal pull-up

To use the internal pull-up resistors from the Arduino you'll need to put this in your setup(): pinMode(pin, INPUT_PULLUP); where pin should be your pin number. Please keep in mind that when you use the internal pull-up resistor a logic 0 means the button is pressed.

share|improve this answer
1  
thx a lot for the trouble you went through explaining at such great length! Very appreciated! :)) – MadCat Jun 12 '14 at 8:16
    
No problem mate. That's why we're here ;) – Handoko Jun 12 '14 at 8:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.