Folks, I am a beginner to Arduino. I have a sketch that tests a set of INPUTS for HIGH or LOW by using a 'for' loop. When the for loop reaches an INPUT which is kept OPEN (no wires connected to it), the for loop apparently 'skips' that INPUT and move on to the next. However, if I have +5V connected to any INPUTS within the range of the for loop, it works correctly. Any thoughts what's is happening here?

  • 2
    probably bad programming ... the arduino will do exactly what you tell it to do, so you are giving it incorrect instructions
    – jsotola
    Commented Dec 1, 2020 at 1:54
  • You can edit your code into the question if you want to try for a more a specific answer.
    – timemage
    Commented Dec 1, 2020 at 16:56

1 Answer 1


You should always connect something to an input to pull it high or low when no signal is present. The simplest thing is to activate the built-in pullup resistor, which will result in the input returning HIGH when there is nothing connected. If that's not compatible with your particular use, add a resistor from the input to ground (10k-100k is fine) so that it will return LOW when nothing else is connected. If the input is just floating, it is susceptible to noise causing random state changes. The input impedance is very high (100 Meg) so it can pick up static and other mischief.

  • Thanks a lot. I'll avoid floating inputs.
    – Ranjith
    Commented Dec 1, 2020 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.