back to back arduino digital IO pins

Hi All Quick question if I may. I want to use the digital O/P if one Arduino(A) to drive the digital I/P of my other Arduino(B). I want to do this to verify the timing of my code driving arduino A. Since I have 2 this seems like the perfect solution. While my software is OK, Im not particularly proficient with electronics, so my question is:

Can I directly connect the digital out pins of arduino A to digital in pins of arduino B ?? and will I have to connect the GND pins as well ??

Many Thanks for your time Phil

Yes and yes. Make sure both are not set to output with one High and the other Low at the same time. Or put a resistor between them to limit current flow as a precaution.

Thanks Crossroads
Thats what I need to know
Cheers
Phil

CrossRoads: Yes and yes. Make sure both are not set to output with one High and the other Low at the same time. Or put a resistor between them to limit current flow as a precaution.

In fact, you need the resistor even if the pins are set correctly. If you unplug one of the arduinos, the other will latch-up the one which is not plugged in, and power it from the digital out. Which is not nice, and healthy.

I second what Crossroads said. While resistors are not normally needed or desired between digital outputs and digital inputs of the same logic family they are a good idea when the the two connected pins might both be programmed as outputs as can be done with microprocessor ports. Having two output ports connected and one of them high while the other is low could happen if the wrong code is uploaded to one or the other or both of the processors.

Something like a 470 ohm resistor would limit the current to a safe value and not interfere with operation noticeably under most conditions.

SurfCracker: Can I directly connect the digital out pins of arduino A to digital in pins of arduino B ??

Yes, but put in a 1K resistor just in case you upload the wrong sketch or something.

SurfCracker: will I have to connect the GND pins as well ??

Yes.

Thanks Guys :) Resistors it is then ! Cheers Phil