Control two pins with one switch

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

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

how is this set up


Hopefully this will help.

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.

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…