See https://www.arduino.cc/en/Reference/PinMode and use INPUT_PULLUP.What is the purpose of the resistors in series with the reed switches?
... they are crimped to male Arduino pin connectors (I picked up a kit of headers and pins for my project)... then I soldered the resistors to a little piece of circuit board with the female header connections...
so you're saying change from:// top switch pinMode(topSwitchPin, INPUT); // set top switch pin as input digitalWrite(topSwitchPin, HIGH); // activate top switch resistorto: // top switch pinMode(topSwitchPin, INPUT_PULLUP); // set top switch pin as input digitalWrite(topSwitchPin, HIGH); // activate top switch resistorand get rid of the resistors? because I have just enabled the internal resistors and no longer need external resistors?
Prior to Arduino 1.0.1, it was possible to configure the internal pull-ups in the following manner: pinMode(pin, INPUT); // set pin to inputdigitalWrite(pin, HIGH); // turn on pullup resistors
If I understand what Archibald is saying, it's that I can change the code to pinMode(topSwitchPin,INPUT_PULLUP), I no longer need " digitalWrite(topSwitchPin, HIGH);", and I can get rid of these external resistors entirely?