How to turn a DIP switch into an array of logical values
Many microcontrollers contain pull-up resistors internally (even Arduino). You often have to configure your pins to activate them (e.g. INPUT_PULLUP for Arduino), and once it is done you can simply connect your DIP switch to the pin and the ground. Besides the obvious advantage of cutting your BOM down, you can be sure R will have the right value for your microcontroller.







simulate this circuit &ndash; Schematic created using CircuitLab