Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Input HIGH with no connection
27-08-2018, 07:21 PM,
#1
Input HIGH with no connection
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?
Reply
28-08-2018, 08:46 AM, (This post was last modified: 28-08-2018, 08:47 AM by pingotg.)
#2
RE: Input HIGH with no connection
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
Reply
28-08-2018, 08:56 AM,
#3
RE: Input HIGH with no connection
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?
Reply
30-08-2018, 09:52 AM,
#4
RE: Input HIGH with no connection
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)