Control two pins with one switch


#1

I need a button that sets one gpio high while it sets another low… and then invert it when it goes off.


#2

It may not be pin efficient but you can always have it set up as so:
Button turns pin x on
pin x in hooked up to whatever you already have and pin y
when pin y is high it triggers pin z to go and the reverse when pin x is low


#3

how is this set up


#4

Hopefully this will help.


#5

be forewarned that shorting a pin out directly is not a good idea… I would be advising the use of a 1k resistor as a buffer as shorting a GPIO pin to ground without a proper resistor, to limit the current to the max allowed value of GPIO pin, can overload and break GPIO or even more - your RPi.


#6

also after looking at the triggers I think i can create digital outputs that will do this but I dont know if I can map a button state this way…