# Integrating on-off-on-off switch with Raspberry Pi GPIO pins

Please note: Although this question involves a Raspberry Pi, I believe it an electronics/wiring question at its heart.

I'm new to electricity & electronics and I'm trying to get this simple on-off-on-off switch to work as a pushbutton to my Raspberry Pi 1 Model A.

By default, this switch works as follows:

1. You press the switch, its "closed" and is considered on, but is routing power through the left pin
2. You press it again and that makes it open/off
3. You press it again and that makes it closed/on, but now its routing power to the right pin
4. You press it again and its off; if you press it again we rinse and repeat this cycle

However I would like to wire the left/right pins together to effectively transform this into a typical on/off switch whereby the behavior is:

1. You press the button and its closed/on, routing power to the line joining the left and right pins together
2. You press it again and its open/off; if you press it again we rinse and repeat this cycle

I believe the wiring diagram for this type of setup is:

So to begin with, if that wiring diagram is incorrect, please begin by correcting me!

Assuming its correct, then this is my best attempt to wire it to my pi:

So:

• Attach left & right pins on the pushbutton together and then route them to the GPIO input pin
• Route the middle pin on the pushbutton the GND on the RPi

Can anyone take a look at this and help nudge me along? Have I joined the left & right pins correctly? Do I need a resistor anywhere (if so how strong and where does it need to go)? Am I wiring the joined left/right pins to the pi correctly? Am I wiring the switch to power & ground correctly? Thanks for any-and-all help!

• Thanks for the explanation on the ohms there @Passerby (+1 again). Sorry, I'm just not 100% understanding you on where to place the resistor though...please see my updated question above. I drew two possible locations for a "R1" resistor...is either of them correct? Thanks again! – smeeb Sep 16 '17 at 2:35