slide switch with Arduino


I have a 4 options slide switch that looks like this:

I tried to make it work with arduino, but I can't find a clue on it's datasheet. Dose anyone know how to connect it with arduino?



Use a meter on continuity across the terminals, you’ll soon find out how it works. It will probably selectively join 2 contacts on one side of the switch with their opposite numbers at the other side. How you connect it to an arduino would depend on what you want to achieve with it. Typically you use a pull up / down resistor to hold a pin high or low and use a switch to short it to ground or 5V to switch it the other way. You could probably program an arduino to do the same as the switch using a couple of push buttons.

This is a 4 position switch. I think the switch shorts opposite connections, that is on opposite sides of the switch body. Confirm this using a resistance meter. To use it connect all one side to ground (all 4 connections). Connect the other side's connections to a septate input pin on the arduino and enable the internal pull up resistors using a digitalWrite(pinNumber, HIGH); Then read the pin with a :- val = digitalRead(pinNumber);