GPIO Button toggle



  • I'm trying to figure out how set up a rule to get a GPIO input button to toggle a GPIO output. I cn get it to turn on as long as the button is held, but no luck getting it to toggle.

    I've spent several hour searching and experimenting with no success.

    Thanks in advance for any pointers.



  • @rpyne Do you want the GPIO to be on when you push the button and GPIO off when you release the button, or do you want it to be like, press, GPIO on, press, GPIO off, press, GPIO on etc.....???



  • @skywatch said in GPIO Button toggle:

    @rpyne Do you want the GPIO to be on when you push the button and GPIO off when you release the button, or do you want it to be like, press, GPIO on, press, GPIO off, press, GPIO on etc.....???

    I want it to toggle with each press, press, GPIO on, press, GPIO off, etc. I figured out how to do it with two separate rules for on and off, but it really should have a toggle function so that it only takes one rule.

    I also want the GPIO settings to allow setting the pull-up or pull-down built in to the newer Rpis so I don't have to use an external resistor to get stable inputs. I tried setting them with the boot overlay, but never could get the inputs to work if initialized through the overlay.


Log in to reply
 

Suggested Topics

15
Online

11.4k
Users

11.1k
Topics

112.7k
Posts