RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    [SOLVED] One GPIO Button Controlling Multiple Python Tasks?

    Scheduled Pinned Locked Moved Help and Support
    gpiobuttonpython
    2 Posts 1 Posters 902 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • obsidianspiderO
      obsidianspider
      last edited by obsidianspider

      Now that I've managed to get my 2.2" display to turn on, display static images, and turn off, I'd like to control the backlight with a pushbutton. I already have two simple python scripts that turn the backlight on or off, but I'm not sure how to trigger something like that with a momentary button. I have seen some tutorials on how to monitor a button and do something if it's pressed but I've not seen it mentioned (or quite possibly I don't know what to look for) to have the button do one thing the first time it's pressed, another thing the second time it's pressed, and then loop back to the first task the third time it's pressed.

      What sorts of things should I be searching for, or can you point me to any good tutorials?

      📷 @obsidianspider

      1 Reply Last reply Reply Quote 0
      • obsidianspiderO
        obsidianspider
        last edited by

        I figured this out and wrote up a basic script to turn the backlight on and off for my secondary display. It's in a post in my Super Famicom build thread.

        📷 @obsidianspider

        1 Reply Last reply Reply Quote 0
        • First post
          Last post

        Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

        Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.