user4527: Is there a way to set an Arduino pin as being both an input, and an output?
I was looking at tristates, I'm not sure if that is related, or if there is some other method.
Perhaps I can try switching states rapidly. on one pin. I'm just not familiar with how to do it, and I don't see anything about it on the Arduino site. 
This is a function of other microcontrollers, such as PICs, but I'm not sure about AVRs and Arduino types. 

user13432: The source code for the 1-Wire protocol is a great place to start when learning how to use a single pin for both input and output. 
See also chap. 18. I/O-Ports in the ATmega328p datasheet. 
Cheers!

user3879: A tri-state pin is not both an input and an output, rather each pin can be in 1 of 3 states (High, Low, High Impedance). These are typically used on a bus, where many similar devices are connected.
AFAIK the Arduino does not support tri-state, but it is possible to implement a bus. This was done by using open collector/drain devices with a resistor pull-up. 
This was a common method of implementing computer busses (more than 40 years ago with RTL logic), but suffers from slow speed, and low fan-out, due to capacitance.
It is still used for low speed short busses such as I²C and 1-wire. 
In practice all devices are set as Input. When a device wants to communicate it is configured as Output.

4527: <p>Is there a way to set an Arduino pin as being both an input, and an output?</p>

<p>I was looking at tristates, I'm not sure if that is related, or if there is some other method.</p>

<p>Perhaps I can try switching states rapidly. on one pin. I'm just not familiar with how to do it, and I don't see anything about it on the Arduino site. </p>

<p>This is a function of other microcontrollers, such as PICs, but I'm not sure about AVRs and Arduino types. </p>
 13432: <p>The source code for the <a href="http://playground.arduino.cc/Learning/OneWire" rel="nofollow">1-Wire</a> protocol is a great place to start when learning how to use a single pin for both input and output. </p>

<p>See also chap. 18. I/O-Ports in the ATmega328p <a href="http://www.atmel.com/Images/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_datasheet.pdf" rel="nofollow">datasheet</a>. </p>

<p>Cheers!</p>
 3879: <p>A tri-state pin is not both an input and an output, rather each pin can be in 1 of 3 states (High, Low, High Impedance). These are typically used on a bus, where many similar devices are connected.</p>

<p>AFAIK the Arduino does not support tri-state, but it is possible to implement a bus. This was done by using open collector/drain devices with a resistor pull-up. </p>

<p>This was a common method of implementing computer busses (more than 40 years ago with RTL logic), but suffers from slow speed, and low fan-out, due to capacitance.</p>

<p>It is still used for low speed short busses such as I²C and 1-wire. </p>

<p>In practice all devices are set as Input. When a device wants to communicate it is configured as Output.</p>
