How to put a 8 - way DIP Switch into a breadboard

Hi everyone!

I'm very new in this Arduino Community, I have to do a pretty complicated project with Arduino (3rd class of high school), which consist to read a 8 - bit number from a dip switch, do the two's complement and finally displays this number to 8 LEDs. I would just like to know how to connect this Dip Switch to the breadboard. Overall, there are 16 digital pins to connect and I have an Arduino UNO which allows 13 digital pins MAX. How to? I could use a Demultiplexer, but I don't know how.

Thanks in advance!

You mean a normal 8-position DIP switch?

It's just 8 separate switches. So the 8 pins of 1 side go to 8 inputs of the Arduino and the other 8 pins go to GND. Be sure to enable the internal pullup ( pinMode(pin, INPUT_PULLUP) ) on all the input pins for the dip switch.

Btw, the analog pins can do digital just fine. The analog is just an extra feature ;) Like some pins have PWM as extra.

You an use the analog inputs as digital inputs / outputs.

If you got the Uno as part of a kit, it might have come with an 74HC595 (serial in, parallel out) shiftregister. You can hook the LEDs to that and it will reduce the number of required pins to (if not mistaken) three for the eight LEDs.

OK, that's fine, yeah I mean THAT dip switch. Therefore, you mean I can use the A0 - A5 analog pins of Arduino UNO like digital PINs, and with these make the project. I know the 8 - way Dip Switch needs 8 digital inputs and 8 GNDs, but i was wondering how to add more PINs to make this happens. Thanks!

Ah, yeay. You have 20 IO pins on a Uno. Of which some have an extra function like analog, SPI, Serial, I2C, PWM etc. But you can use all for digitalRead. I thought you thought you needed 16 pins on the Uno to just read the DIP switch ;)

WillyBestSM:
Therefore, you mean I can use the A0 - A5 analog pins of Arduino UNO like digital PINs, and with these make the project. I know the 8 - way Dip Switch needs 8 digital inputs and 8 GNDs, but I was wondering how to add more PINs to make this happens.

Do you mean you were wondering, or are wondering?

So you have 20 available digital pins, but 0 and 1 should be reserved as they are the serial interface, but 18 left - more than enough - pins 2 to 13, A0 to A6.

So as explained before, each switch goes from a pin to ground and you use INPUT_PULLUP mode to pull the inputs up when the given switch is not ON. So that input will be HIGH when the switch is open, LOW when it is closed. You need to write your code accordingly.

Don’t forget to put resistors between the outputs and the LEDs.