fuzzybabybunny:
So if the float switch is totally disconnected (float is in the vertical position) and connected to a digital pin that doesn't have an internal pullup resistor, the pin will still just randomly read HIGH or LOW due to environmental electromagnetic interference? Is that it? Basically, if the pin's not connected, it will still have random continually-changing voltages running through it, and some of those voltages will hit levels that cross the threshold for "HIGH" while some of them won't at different times.
Yes, a floating input floats - the clue is in the name. CMOS inputs are completely insulated by the MOSFET
gate oxide layer, which is why they float. The to the question is you always need a pull-up or pull-down to
define the pin state.
Hmmmm... how would having random voltages ever be useful? Why don't all the pins have built-in pullup resistors to "quiet down" the voltage when there is no signal present? It seems like the internal pullup resistor can be enabled or disabled on command anyway since you have the explicitly set INPUT_PULLUP in pinMode for that pin.
On the Uno all the inputs have pull-ups. And normally you've never leave any input unconnected in CMOS,
that's bad news for a low power circuit as floating inputs can draw significant current in the input stage due
to being half-on and half-off (that current isn't through the pin, note).
The internal pull up would be disabled for micro-power applications when the pin is normally LOW, as a massive 150uA might flow through the pull-up then, and micro-power budget might be 5uA or less
in some cases.
A floating input can lead to its input section pulling several mA, note, an even worse problem for
micropower (CMOS circuits pull no current if all inputs are defined and the circuit isn't being clocked)