Multiple arduinos sharing an input

I needed more digital pins for a project. The answer for me was register chips and all is good.

But while trying to come up with a solution, one of the ideas I discarded was using a second arduino. And this brought up a question that's been bugging me. Is there any way that two arduinos could share a digital input? For instance if I have a button and I set two pins to INPUT_PULLUP, one on each arduino. I have ground and power going into arduino 1. I imagine taking that power and putting it into the input of arduino 2 would be bad, right? Is there any configuration that would allow me to do this?

No practical use for this really, but just something making me really curious.

Use a diode to each Arduino's input pin, cathode to button, anode to pin. Common the grounds only.

Ah okay, thank you. Can you explain what you mean by common the grounds only? I’ve tried googling it but all that come up with is explanations of the term ‘common ground’. Does this mean the ground of the button should only go the the ground of arduino 1?

Common grounds mean wire the grounds together. Do not wire the 5V lines together. You can wire the power input jack wires together if you are powering it that way.

Well, actually,

For a start, you must connect the grounds together, that is just basic electricity.

There are then two - no, three interesting questions.

  • Should you enable INPUT_PULLUP in one, or both? Both are possible, the inputs are of such high impedance that only one needs to be enabled, as long as it would operate OK with INPUT_PULLUP if you were using only one Arduino input.

  • Is there a risk that both pins connected together will be set as outputs with different HIGH/ LOW values? This is the same consideration as connecting two pins together on a single Arduino.

  • Should you connect the 5V lines together? This is a very interesting question which does not have an automatic answer. There is some concern that tying the output of two active regulators together might cause conflict and possible oscillation but you would have to research this in the datasheets and application notes. If the regulators are properly stabilised, all that should happen is that the one with the higher regulation point will tend to “take over” the task of supply. If the total loading is such that one regulator alone could handle supplying both, then only one regulator need be powered up (at Vin). Another stable option would be that one external regulated supply would supply both at 5V.

The particular problem with not having both 5V supplies tied together, is that one Arduino might be turned on and the other off, the latter would automatically pull down the common input by its internal protection diodes.

Never wire the output of voltage regulators in parallel.

MarkT: Never wire the output of voltage regulators in parallel.

+1 for me on that as well.

but you would have to research this in the datasheets and application notes.

Never seen a data sheet mention that at all.