Communication between arduinos over 4 interchangeable pins

retrolefty:

granmicky:
Here is what I need to do:
I need to connect 2 arduinos using 4 wires. Easy, right? The tricky part is that they need to communicate despite the way these 4 wires are connected. Let me explain:
4 I/O pins on one arduino will be connected to 4 I/O pins on the other arduino, but the communication MUST be possible even if we interchange the connections.
Is this possible? I could add a 5th wire for common ground but it would actually be best if one of the wires could act as ground (even though it is not known which one). Does it make sense? Do you guys think it can be done?

This sounds basically unworkable. The two arduinos must know for sure what pins to use as output pins and which to use as input pins. If they are randomly mixed up then you are likely to have two output pins wired to together effectively causing a short circuit and pin damage.

Can you tell us what you are trying to accomplish rather then how you think it might be accomplished?

Lefty

Ok, I am trying to make a puzzle with cubic pieces. You know, the type with different images on each side. What I want to accomplish is to have one arduino (a microcontroller really) inside each piece (I'm thinking 6 or 9 pieces) and establish a connection with the adjacent pieces thru a conductive joint on each corner of each piece. Each cube can inform its adjacent cubes of its orientation so that when the information flow is complete each cube know the pictures that are showing (one on each side). Does it make sense to you guys?
That is why I need the communication wires to be interchangeable, because the relative position of each cube can change by rotation (i.e. if corners 1, 2, 3 & 4 are connected to corners 1, 2, 3 & 4 and the cube is rotated, then the connection would be 1-2, 2-3, 3-4 & 4-1).
Obviously, the sketch running on each cube is identical except for the information about themselves, that is, which images are showing on each side. Also, I onlu spoke of connecting four pins but I would need to implement it for all sides of the cube.

I like the idea of making some kind of an initial poll to assign pins and then using softserial. I haven't really worked on the consequences of an eventual shortcircuit so I really don't know how to protect the circuit from over currents.

Thank you very much.