Pinguino Forum

Full Version: Input HIGH with no connection
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When trying to read a pin set with pinMode(n, INPUT), I sometimes get HIGH readings on itĀ even though I have nothing connected to it. Is this to be expected?
It's not safe to leave an input floating/unconnected (unless it's a pin with an enabled internal pullup) - it can cause damage to the chip as well as causing unpredictable readings.

It's worth reading the chip's datasheets, which usually contain warnings about many things including probably this one..

John
I see. The intention was to have a debug switch, kind of like a jumper. Some code would be executed only if the pin was high, and which could be changed manually while the routine is still running. How could something like this be achieved?
Tie it high or low via a resistor or two and short one out with the jumper/switch - there are examples online if you look.

Read the datasheet to see which is the right way to choose.

John