Retropi + GPIO = Not Working (Using adafruit more info in post)
-
Hello,
(UNSOLVED)
Is their any code I can run to make 2 joysticks and 6 buttons (three for each player) start select and 1 player and 2 player buttons work on GPIO I've only found a joystick and 6 button script (adafruit) But its the joystick and 6 buttons so if their was some way I can duplicate the buttons so 2 of each for each player so a, b, x or whatever I need for 3 buttons each in total I have 2 joysticks and 8 buttons (6 game buttons 3 per person and a 1 player 2 player button) Any help on what I can use to make that work on retropie through GPIO is appreciated!(SOLVED) I'm using a Raspberry Pi 3, So I have connected an arcade joystick a start button, select button and an extra 6 buttons for gameplay to raspberry pi gpio pins, after using adafruit download through some lines of code I found online I installed the joystick and 6 buttons package to make gpio pins register in retropi after wiring everything only up down left right start select work but the 6 gameplay buttons do not if I wire 6 gameplay buttons to the gpio pins where the up down left right used to be they work so I'm assuming adafruit has configured only a few gpio to work although its joystick and 6 buttons only a joystick and 2 buttons work so I'm not sure what to do from here trying to stay away from encoders Ive tried connecting 6 gameplay buttons to every other pin and does not register. I'm very new to this so any help is appreciated Thanks!! :)
-
@r0shen I'm sure you followed Adafruit's retrograme tutorial, but probably the buttons aren't connected to the corresponding GPIO pins.
Take a look at/boot/retrogame.cfg
.
This is an example of what you'll find in this file:LEFT 4 # Joypad left RIGHT 19 # Joypad right UP 16 # Joypad up DOWN 26 # Joypad down LEFTCTRL 14 # 'A' button LEFTALT 15 # 'B' button Z 20 # 'X' button X 18 # 'Y' button SPACE 5 # 'Select' button ENTER 6 # 'Start' button A 12 # Left shoulder button S 13 # Right shoulder button ESC 17 # Exit ROM; PiTFT Button 1 1 22 # PiTFT Button 2 2 23 # PiTFT Button 3 3 27 # PiTFT Button 4
Check if they match.
To change this file go to the terminal and enter
sudo nano /boot/retrogame.cfg
.
Change the KEYS and GPIO numbers to your liking and thenCTRL+O
, hitENTER
to save it andCTRL+X
to close it.The GPIO numbers must be the BCM numbers. Check this website https://pinout.xyz/
-
@hiulit said in Retropi + GPIO = Not Working (Using adafruit more info in post):
/boot/retrogame.cfg
How would I get to the screen that would show that? And are the green numbers the GPIO numbers or pin number?
-
@hiulit said in Retropi + GPIO = Not Working (Using adafruit more info in post):
To change this file go to the terminal and enter
sudo nano /boot/retrogame.cfg
.
Change the KEYS and GPIO numbers to your liking and thenCTRL+O
, hitENTER
to save it andCTRL+X
to close it.Like this ;)
-
@hiulit said in Retropi + GPIO = Not Working (Using adafruit more info in post):
The GPIO numbers must be the BCM numbers. Check this website https://pinout.xyz/
Go to this website and use the BCM numbers :)
-
@hiulit
So use the BCM numbers on the left and right and plug each butten and write the corresponding numberon the boot retrogame cfg file? -
@hiulit
Sorry I'm a noob at this stuff so I can wire up to any BCM number from the pinout website photo? -
@r0shen Don't worry, no need to apologize :)
Yes, you can wire up to any BCM number.
You also need to connect the joystick and all the buttons to GROUND. -
@r0shen Here, a pic with the GPIO pinout (here it says GPIO instead of BCM)
And how it looked like when I was starting my project :)
-
@hiulit
Eyyy!! Thank You SOOOOOO Much I got it working currently enjoying some donkey kong Thank You sooo much haha :) -
@r0shen Alright!!! :D I'm glad you're enjoying some retro games!
-
@hiulit
If I was to do a 2 player is their an adafruit gpio code to make 2 joysticks and 3 buttons on either side work? -
@r0shen You can tweak the same file and add as many KEY/GPIO values as you want.
-
@hiulit
Where would you add the duplicate joystick and three buttons? -
@r0shen Below the KEY/GPIO values you already have.
You just need to assign new values. Example:
W 21 # 2 player UP S 22 # 2 player DOWN A 23 # 2 player LEFT D 24 # 2 player RIGHT P 25 # 2 player 'A' button etc...
and so on.
P.S. This example is completely made up! ;) But you get the idea, right?
-
@hiulit
So the name such as 2 player UP
2 player DOWN does it matter what it's named? or does the name correspong with something in retropi? and also would you know in retro pi where to configure an extra joystick and duplicate buttons (e.g. 2 x buttons 2 y buttons and so on) -
@r0shen No, those are comments. Everything that comes after a hashtag
#
is a comment. So it doesn't matter what you write there. It's just so you know what the key represents.
And for the second question, I don't know, but you could take a look at the docs https://retropie.org.uk/docs/RetroArch-Configuration/ maybe you'll find something there :) -
@hiulit
So All it does is make each GPIO number a keystroke and you just wire your controlls to it and use the keystroke as up down left right button a b x y and so on. You just write what it is to know whats in that GPIO number right? anyway to add more of the GPIO pins to that code? -
Hi there ^^,
I´m new here and I seriously need help. I´m doing an Internship right now and my finishing Project is trying to build my own MintyPi, whith a Raspberry Pi Zero. The emulation Station is working, with an extern USB Controler.
I soldered my own board for Buttons. And I checked the Buttons funktion. They´re doing their job.
I installed the new image and everything.I´m totally new to Raspi and Linux.
For 5 Days now, I tried to configurate the Buttons: A, B, X, Y, UP, DOWN, LEFT, RIGHT, START, SELECT, L, R
I loaded down the Adafruit retrogame and loaded the PiGRRL Zero.
Looks kind of like this:LEFT 27 # Joypad left
RIGHT 22 # Joypad right
DOWN 5 # Joypad down
UP 4 # Joypad up
Z 14 # 'A' button
X 16 # 'B' button
A 21 # 'X' button
S 20 # 'Y' button
Q 12 # Left shoulder button
W 6 # Right shoulder button
LEFTCTRL 19 # 'Select' button
ENTER 17 # 'Start' buttonthese numbers are the bcm i read out over
gpio readall
I also tried the GPIO pins from the coulerfull picture earlier in the chat:LEFT 27 # Joypad left
RIGHT 22 # Joypad right
DOWN 05 # Joypad down
UP 04 # Joypad up
Z 21 # 'A' button
X 16 # 'B' button
A 26 # 'X' button
S 20 # 'Y' button
Q 12 # Left shoulder button
W 06 # Right shoulder button
LEFTCTRL 19 # 'Select' button
ENTER 17 # 'Start' buttonBut the only thing that works as said is ENTER 17, this is the only button working correctly.
on the last setting the
X button does LEFT
Y button does DOWN
L button does UP (but not always)
and the others are doing nothingSo my guess is that the pins might be correct but the commands LEFT, RIGHT, etc.
are not assignt correctly.I would be really gratefull O3O
if you could help me find a solution. -
So I actually found an smal pice for a solution. Turns out I had a german keyboard configured.
The Adafruitprogramm, seems to take the keys from the keyboard an transfers it to my own buttons. Since I used an german keyboard it didn´t work. I changend to us keyboard, but that didn´t work either. I´m back to german keyboard now. So I changed the Names of the Keys:
A 27 # Joypad left
D 22 # Joypad right
S 5 # Joypad down
W 04 # Joypad up
? 21 # 'A' button NUM6
? 16 # 'B' button NUM5
? 26 # 'X' button NUM4
? 20 # 'Y' button NUM8
? 12 # Left shoulder button must be the 3§³ Key
"+" 6 # Right shoulder button on NUM+ + without the ""
#' 19 # 'Select' button must be the '# Key
ENTER 17 # 'Start' buttonSo far, so good.
My new Problem is that I don´t know the correct names of the keys needed.
Does anyone of you know where i could find them?Would be great if anyon could answer :D
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.