Can I set Arduino's pin as bidirectional I/O

Hello guys

Could somone answer me if it there is a possibility to set Arduino's pin as bidirectional I/O?

Thanks in advance


A pin can only be an input or an output at any one time, but you are free to change that whenever you like with pinMode()

Perhaps you mean can it be used as an open-collector bus?

Hello MArkT

First of all thanks for your kindly answer.

Perhaps you mean can it be used as an open-collector bus? - Uhmm really no, just I wanted to use some pins as bi-directional cause I am talking with another circuit board and I need to syncronize them in order to make these talking correctly.

Well, anyway thanks so much again


Perhaps if you gave details of the other circuit board, or of the sychronization involved, it would become clearer?

Logic signals are either unidirectional, or bussed, and bussed signals normally have a protocol for deciding which of the attached devices can transmit at any one time (aka half-duplex). There's no such thing as a full duplex bidirection logic signal, that's a more specialized thing that might be used in some transmission line drivers.

How do you imagine you would measure a logic level (INPUT) and set a logic level (OUTPUT) on a wire at the same time?

What you can do is having the pin SOMETIMES being an output and SOMETIMES being an input. Then you would have to specify a protocol so your devices know when they are allowed to talk and when they are allowed to listen. Such protocols are e.g. I2C (with one data and one clock wire) and OneWire (with only a single data wire).

As MarkT already mentioned, such networks are usually designed as open collector networks, because they do not go up in smoke if at one or more parties violate the protocol (or the protocol includes random probing and two probes overlap) and talk at the same time.

So I highly suggest you listen to the people here and overthink what you want to do, because it seems a lot like you have some misconceptions that lead you to ask for something that is physically impossible.


  • Uhmm really no,…

Uhmm really, it would help you, help us, if you read:

And, if you want to be a top-notch poster, read this, too: