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

    Single GPIO button

    Scheduled Pinned Locked Moved Help and Support
    gpioexit gamevolume control
    11 Posts 6 Posters 4.1k 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.
    • TheGrovesyT
      TheGrovesy
      last edited by TheGrovesy

      Hi all I have retropie successfully running on my pi zero using a USB snes controller for input. I would now like to add an additional button, using the gpio, which I can use to exit from any emulator I am running and return to retropie interface. Ideally I want to do this without any additional gpio boards to keep the size down. Any pointers on how to do this would be great.

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

        @TheGrovesy

        Not to say a GPIO button is bad, but why not just use Select+Start to exit an emulator, and it's built in to RetroArch?

        📷 @obsidianspider

        TheGrovesyT 1 Reply Last reply Reply Quote 0
        • TheGrovesyT
          TheGrovesy @obsidianspider
          last edited by

          @obsidianspider thanks for the information I didn't know that... works great thanks.

          1 Reply Last reply Reply Quote 0
          • Z
            Zigurana
            last edited by Zigurana

            Ok, this issue has been solved for @TheGrovesy, but I think its still an interesting question.

            Lets say that someone, ahum, had planned and planned and wired up some buttons and in the heat of the moment decided that 4x4 buttons looked much better than a row of 4 and a row 3 three buttons, and therefore well, now has a spare button, but no more connections on his Dragonrise USB to hook it up to. Purely hypothetical, of course, ahum.

            It would be nice to be able to use the button anyway, for instance to work as an universal exit button. The plan was not to use an explicit hotkey anyways. In this situation one would have a mixed controller setup: most buttons would originate from the USB controller, but one from some GPIO interface (PiKeyd?).

            Maybe sending a sigint or sigkill, as was suggested in this thread would be a bit much, plus it would break ES as well when pressed while in ES.

            There is an route discussed by @mike and @jackal123uk here, to use some kind of network commands to 'contact' retroarch from an external source, maybe that is the way to go here? Seems rather heavy-handed for such a small button...

            Any suggestions?

            If tetris has thought me anything, it's that errors pile up and that accomplishments dissappear.

            TheGrovesyT 1 Reply Last reply Reply Quote 0
            • TheGrovesyT
              TheGrovesy @Zigurana
              last edited by

              @Zigurana yes my question about exiting the emulator was resolved. However I would now like to use GPIO to control the volume. So my question about how to map GPIO to functions is still unresolved.

              T 1 Reply Last reply Reply Quote 1
              • T
                tehswiftone @TheGrovesy
                last edited by

                @TheGrovesy You can also bind your controller to change the volume. I will have to look at my controller config when I get home from work.

                1 Reply Last reply Reply Quote 0
                • T
                  tehswiftone
                  last edited by tehswiftone

                  Add this inside of your controllers config, don't forget to replace button with a proper button ID. This will be similar to exiting an emulator, you will use select + button to use it. So don't worry about it taking up a button on your controller.

                  input_volume_down_btn = "button"
                  input_volume_up_btn = "button"

                  TheGrovesyT S 2 Replies Last reply Reply Quote 0
                  • TheGrovesyT
                    TheGrovesy @tehswiftone
                    last edited by

                    @tehswiftone thanks for the info. Where do I find the controller configuration file?

                    Also if I really did want to do this with GPIO would it still be done with the same config file?

                    T 1 Reply Last reply Reply Quote 0
                    • TheStrayMongrelT
                      TheStrayMongrel
                      last edited by

                      Its a bit of fiddling around but you could use this @TheGrovesy
                      https://learn.adafruit.com/retro-gaming-with-raspberry-pi/buttons

                      Thats what i use to map gpio buttons to keyboard strokes which run my arcade controls (joysticks, 6 control buttons, 1 and 2 player start and coin buttons, and an exit button) . You'd have to heavily edit the config but would be doable.

                      Raspberry Pi 2 B+

                      1 Reply Last reply Reply Quote 0
                      • T
                        tehswiftone @TheGrovesy
                        last edited by

                        @TheGrovesy You should be able to find your controller config inside /opt/retropie/configs/all/retroarch-joypads/

                        No it would not be done in the same file. It's a lot of work for a small gain, not to mention you would have to get up to change the volume :). If you are really itching to learn and want a GPIO project I would recommend setting up power/reset buttons.

                        1 Reply Last reply Reply Quote 0
                        • S
                          SirBilly @tehswiftone
                          last edited by

                          @tehswiftone said in Single GPIO button:

                          Add this inside of your controllers config, don't forget to replace button with a proper button ID. This will be similar to exiting an emulator, you will use select + button to use it. So don't worry about it taking up a button on your controller.

                          input_volume_down_btn = "button"
                          input_volume_up_btn = "button"

                          I have mine setup to use Up and Down on the D-pad. Just change the "btn" to "axis".

                          input_volume_down_axis = "+1"
                          input_volume_up_axis = "-1"

                          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.