Arduino - Teensy 4.2 - 8-Position Dipswitch Circuit Schematic
This is a very basic circuit diagram to show you how I have successfully wired an 8 position dipswitch to an Arduino Teensy 4.2 and this also works with an Ardui Mega board but requires slightly different values considering that one is 5v logic level instead of 3v.