I/O input reading random

AndreBologna:
Well,
if wire is not connected and it's free then is possible to see interferences captured so it could read random value.... what i dont aspect is reading of random value if wire is plugged into a breadbord, the electrical path in it is surrounded by plastic so it shoudnt capture anything :frowning:

I get it wrong?

The fact that you have a wire connected to a breadboad doesn't change that there is no valid electrical voltage being applied to the input pin just noise. An input pin is a voltage sensing device that needs a voltage applied to it via an external circuit, the value of the voltage will determine if the pin will read it as a HIGH or a LOW logic level. So with no complete circuit attached the pin is said to be in a "floating input pin condition" and will just respond to random noise as to if it returns a HIGH or LOW when you perform a digitalRead() command. So you have to always have a valid voltage applied to a input pin for the pin to return valid values, high or low, when reading the pin. This can be done several ways. There is a way to enable an internal pull-up resistor for the pin using software command that will cause the pin to always read HIGH even with nothing connected to the pin. You can also wire external resistor (say 10k ohms) to the pin either to ground or to +5vdc voltage so that it will always return a LOW or HIGH respectivly.

So in passing, the input of a digital input pin is where the electrical world meets the software world and in the electrical world one has to insure proper circuitry wiring and proper applied voltages. Also when using digital output pins one has the responsiblity that the external electrical circuitry does not try and draw more current from the output pin then the pin can safely supply without damage.

So does that help? If you have specific questions about this I will gladly try and explain further.

Lefty