Input pin - Default State

When I declare a pin as input, isn’t it supposed to be maintaing a low level at all times till a high input is recieved?

An input pin will read the state of a logic signal wired to it. If left unconnected (floating) it is not guaranteed at which state it will assume, and subject to switching with just circuit noise.

However if the internal software pull-up is activated for the pin then the input will assume a HIGH input value even if not wired to anything externally.

There is no software pull-down available so the only way to assure a low on a unwired input pin is to wire a resistor to ground from the pin.

Lefty

Lefty, Thanks for that info but there must be a way to disable that pull-up???

…but there must be a way to disable that pull-up???

Actually you set it with digitalWrite(pin,HIGH); and if you do not set it, it is not enabled. :slight_smile:

Lefty, Thanks for that info but there must be a way to disable that pull-up???

As AB posted above the soft pull-up is optional and not enabled unless you do a digitwrite high after setting the pinmode to input. However not setting the pull-up does not ensure that the pin will assume a digital low if left unconnected. It will be floating and subject to switching logic levels with noise, tides, time of day, etc… :wink:

Again, to insure a low on a unconnected input pin there must be an external pull down resistor installed.

Lefty