Hello,
I need to use one Arduino (A) to push buttons on another Arduino (B).
Please let me know if what I want to do is correct (no magic smoke please):
Digital pins 2,3 and 4 from Arduino A connect to analog pins A1, A2 and A3 on Arduino B. On Arduino B I also have pushbuttons on the analog pins A1, A2 and A3. Both Arduinos are connected to the same power supply (a powerbank). Setting the digital pins on Arduino A to HIGH or LOW will simulate the press of the pushbutton.
I need to add aditional components or it is safe to do it like described in the attachement?
Thank you!
Some details about my project:
I want to use nrf24l01 to send audio using the RF24Audio library when the sound detected by the microphone is above a defined threshold. Sending audio is easy thanks to TMRh20's library, but it takes all the resources of one arduino. So I will use two pairs of two Arduinos and nrf24l01 on each Arduino.
isn't it practical to get a more capable board? maybe a pi?
PLease note that TTL Logic Signals are designed to be connected to each other. The pins of one device are supposed to be able to signal the other. This is by design. As long as they have a common GND between them... it will just work. (provided you remove any pullups you were using... since now there will not be a floating state).
If a digital pin happens to be high when someone pushes the button (only you know how likely that is), then that pin will be shorted to ground. That would be a bad thing...
pwillard:
PLease note that TTL Logic Signals are designed to be connected to each other. The pins of one device are supposed to be able to signal the other. This is by design. As long as they have a common GND between them... it will just work. (provided you remove any pullups you were using... since now there will not be a floating state).
Thank you! Just wanted to be sure.
DaveEvans:
If a digital pin happens to be high when someone pushes the button (only you know how likely that is), then that pin will be shorted to ground. That would be a bad thing...
You are right, that may happen. In that case is it safe if I add a 10K resistor between button and ground?
Thank you!
Magicool:
You are right, that may happen. In that case is it safe if I add a 10K resistor between button and ground?
If you do that, then if the digital pin is high (as it presumably is most of the time) and you push the button, what will be the voltage at the analog pin? Is that what you want?
All I want is Arduino A (via digital pins 2,3,4) make Arduino B "think" that the button (on analog pins A1,A2,A3) is pushed/released.
How I imagine it shuld work:
On Arduino A: digitalWrite(HIGH) to "press the button" and digitalWrite(LOW) to "release the button".
On Arduino B the pins are defined in the RF24Audio library:
#define TX_PIN A1 // Button pin to trigger recording & transmission
#define VOL_UP_PIN A2 // Pin for external volume control
#define VOL_DN_PIN A3 // Pin for external volume control
and
pinMode(TX_PIN,INPUT_PULLUP);
pinMode(VOL_UP_PIN,INPUT_PULLUP);
pinMode(VOL_DN_PIN,INPUT_PULLUP);
If you think I can get in trouble using the physical buttons I will just remove them if I have no other option.
Thank you!
Magicool:
How I imagine it shuld work:
On Arduino A: digitalWrite(HIGH) to "press the button" and digitalWrite(LOW) to "release the button".
No, that's not how it will work. Since the RF24 library defines the pins as "INPUT_PULLUP", it seems to expect those pins to be normally HIGH and triggered only when they go LOW. BTW, that's exactly how you've got your physical buttons designed (per the figure in your first post).
So Arduino A must mimic that: normally, the Arduino A pins must output HIGH (or be high Z); to simulate a button press, they temporarily go LOW.
You do need resistors, but not where you proposed. Sorry - got to run. More later. In the meantime, see if you can figure out why I said what I did in post #5. It might help to draw a schematic and read up on "INPUT_PULLUP".....
Lets see what I can understand 
Arduino B has the pins set to input and kept HIGH (via internal pullup resistors). To trigger the action I press a switch connected to the pin and ground.
Arduino A must set pins on Arduino B to LOW (pinMode OUTPUT and digitalWrite the pin to LOW). I think this means I am setting the pins on Arduino A as GND (LOW).
Does this make sense?
Forgot the resistors: around 1k resistor between the connected pins?
Yes, sort of, that's good start, but what you wrote is not a complete description. For example, it's not clear where the switch is located relative to the 1k resistor and whether you are still proposing a resistor between the switch and ground. Also, it's not clear how long Arduino A will "press" the button and how it will "release" the button.
To overcome such issues, it's best to communicate with a schematic and code (not "in writing").
Do you know how to draw a schematic? If so, draw one (by hand is fine) and post it (a photo is fine...and see this link for posting photos). If not, check out How to Read a Schematic - SparkFun Learn and then give it a shot (for now, just focus on the resistors, switches, and ground). Draw the circuit you propose for just one of the pins (not all three, since they're fundamentally the same). Include the two Arduinos, the momentary contact switch, and the resistor or resistors you propose. The figure in your first post is not a schematic, by the way; please discard that and draw a schematic that fills in the "?" area of the figure below.
Also, post the Arduino A code; that should help to clarify your approach to using Arduino A as a "button presser." If you haven't written code for Arduino A yet, then just create and post "pseudo-code" such as that in post #2 here Planning and Implementing an Arduino Program - Programming Questions - Arduino Forum But include the pinMode and digitalWrite statements in setup(), as well as the C++ statements that Arduino A will use to "press" and "release" a button, presumably somewhere in a function called in loop()...

Hello,
Arduino A code:
#define SOUND_SENSOR A0 //microphone
int sensor;
const int simSW1 = 2; //digital pin 2 "press/release" switch 1
void setup()
{
pinMode(simSW1, OUTPUT);
}
void loop()
{
sensor = analogRead(SOUND_SENSOR);
if (sensor > 300)
{
digitalWrite(simSW1, LOW); //keep "pressing" switch 1 as long as sensor value > 300
}
else
{
digitalWrite(simSW1, HIGH); //"release" switch 1
}
}
And the schematic:
Looks good to me!
A few minor points:
The default for pinMode(simSW1, OUTPUT) is LOW, so the switch will be "pressed" for the short time between calling pinMode in setup() and doing your first digitalWrite in loop(). If that matters...
Also, no need to use an int for simSW1 - it will fit in a byte: const byte simSW1 = 2; Not important for a small sketch, but why not get in the habit.....
The schematic would have been a bit cleaner if the switch was below the line between the resistor and Arduino B - generally, avoid crossing lines, if possible (picky picky) 
And, to eliminate the comments after the digitalWrites, you could define two constants, PRESS and RELEASE, and use those instead of LOW and HIGH.
Another thing, for future consideration, is that if sensor > 300 and simSW1 is already LOW, there's no need to write it LOW again, and if it is <= 300 and it is already HIGH, there's no need to write it HIGH again. Some reading relative to this: Gammon Forum : Electronics : Microprocessors : State machines
PS: there's a way to do this without using a resistor or any digitalWrites:
- pinMode(simSW1, OUTPUT) to press the switch, since it defaults to LOW
- pinMode(simSW1, INPUT) to release the switch; that puts the pin in high impedance state...so Arduino B sees HIGH due to its pull-up, and a manual button push will not cause any current to flow thru Arduino A's pin (so no need for a resistor to protect against that)
But, that's not as intuitive as using digitalWrites, and in any case the 1k resistor is good insurance against accidentally setting a pin to the wrong state and killing something.
Hello,
Thank you so much for your help! All clear now.
Picky makes it perfect!!! No problem here.
Have a nice day!