pull-up problem?

I'm using pins 42, 44, 46 and 47 as input, with 47 using a pull-up:

  pinMode(42, INPUT);
  pinMode(44, INPUT);
  pinMode(46, INPUT);
  pinMode(47, INPUT);
  digitalWrite(47, HIGH);

nothing is connected to pins 44 and 46 though

then I'm just printing their values:

Serial.print(digitalRead(47));
Serial.print("\t");
Serial.print(digitalRead(42));
Serial.print("\t");
Serial.print(digitalRead(44));
Serial.print("\t");
Serial.print(digitalRead(46));
Serial.println();

the problem is... when there's nothing connected to pin 47 (ie, it's high due to the pullup resistor), pin 46 starts to show as HIGH sometimes... and as LOW some other times

when I connect ground to pin 47, pin 46 behave always as LOW

my doubt... why 46 doesn't behave always as LOW since there isn't +5V connected to it? why it's changing state depeding on pin 47 (which supposedly has nothing to do with pin 46)

The pins without pull-up resistors are floating pins. If nothing is connected to them, the state of the pin can not be relied upon.

If nothing is connected to them, the state of the pin can not be relied upon.

And another thing every piece of electronics behaves like this.

just curious... does anyone know what physically determine if an unconnected pin is on or off?

is it something like micro current fluctuations, interference, the state of other pins?

does anyone know what physically determine if an unconnected pin is on or off?

Does a tree falling in the forest make any noise if there is no one around to hear it? Does it matter?

If nothing is connected to the pin, it doesn't matter what its state is.

does anyone know what physically determine if an unconnected pin is on or off?

Yes I know but like the man said why would you want to know.

It is caused by electric field pickup on the high impedance input coupled with noise fro the rest of the circuit.

just curious… does anyone know what physically determine if an unconnected pin is on or off?

That’s the thing with a floating input pin, you could read it one time and get back a on and read it again in a second and read a off. Just call it circuit noise and move on.

Lefty