0

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 May 10 at 9:52
  • the description suggests that it is a SPDT with center off ... that means that the switch has three states – jsotola May 10 at 17:28
4

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.

schematic

simulate this circuit – Schematic created using CircuitLab

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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