Single GPIO button
-
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.
-
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 thanks for the information I didn't know that... works great thanks.
-
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?
-
@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.
-
@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.
-
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" -
@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?
-
Its a bit of fiddling around but you could use this @TheGrovesy
https://learn.adafruit.com/retro-gaming-with-raspberry-pi/buttonsThats 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.
-
@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.
-
@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"
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.