I purchased this toggle switch recently because I want to use it in my project:

enter image description here

But I don't know what to connect up the three pins to and I can't find any information about it online. Nor can I find sample code. Can someone show me how to wire it up and provide sample code please?

  • Did you read the description? It's basically a push-button toggle switch that connects and disconnects the middle pin from either of the two side switches with every click.
    – Majenko
    Commented May 10, 2020 at 9:52
  • the description suggests that it is a SPDT with center off ... that means that the switch has three states
    – jsotola
    Commented May 10, 2020 at 17:28

1 Answer 1


It's basically a push button. Possible examples depend on what you want to do. As it seems, you simply want to start interfacing it with Arduino, just use it as a normal push button. Use the DigitalInputPullup example, that comes with the Arduino IDE:

Middle pin to pin 2 on the Arduino
One of the other pins to ground (depending on which state you want to be reflected with a HIGH in the Arduino)
The other pin unconnected

Look at these two schematics. The left one is a normal push button. It connects, when pressed and disconnects, when released. The right one is your button. When pressed it disconnects the upper pin and connects to the lower pin. When released vice versa. When you don't use the upper pin, your button behaves just like the push button on the left.


simulate this circuit – Schematic created using CircuitLab

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.