hello quique
there are many ways ![]()
depends on the speed.
if you use a shielded cable where the shield is connected to ground this will help with possible noise. there are some cases where the lenght of the cable can become an issue and possibly damage the output pin.
To be 100% on the safe side you can use an RS485 transceiver.
This uses any couple of wires (better a telephone style twisted pair cable) you put a max485 on one side and one at the receiving end. this allows you to go up to 1MBit/sec over very long wires.
see http://pdfserv.maxim-ic.com/en/ds/MAX1487-MAX491.pdf at the bottom of page 7 you find a schematic diagram.
on page 8 you see bidirectional communication.
hope this helps
massimo