, I maintained the following facts:
Revealed on page 93 of Simon Monk's Programming Arduino GSWS book that the internal pull-up resistor is not enabled unless and until the following lines of code are executed: int inPin = 5; pinMode(inPin, INPUT); digitalWrite(inPin, HIGH); |
|---|
To my surprise, I have discovered an alternative that is part of the Arduino programming language.
The pinMode() function has a third mode called INPUT_PULLUP.
Documentation can be found here and here.
This allows one to happily avoid the counter intuitive need to 'write' to an 'input' pin.