Upcoming shows/vending:

Pittsburgh *Maker Faire 2017

 

 

 

 

 

 Know of a show I should go to? Tell me!

* indicates big show (attendance in the thousands)

Mapping for GPIO Arcade Buttons

What keys are the GPIO buttons mapped to? Here's a Cheat sheet you can press into you GPIO headers and it will make things easy. These mappings are for the following Porta Pi Arcade images:

v4.1 (B+ or B) 

v2.x  (B only)

Use this handy diagram when wiring to your Pi's GPIO headers. Use for B and B+.
GPIO header mapping cheat sheet for webs[...]
Adobe Acrobat document [50.7 KB]

Edit Keyboard Mapping for GPIO Arcade Buttons

So your red button is mapped to GPIO pin 13 and you want to move that to pin 19? One of your buttons is mapped to keyboard letter R,  and you want to change the letter to W. You need to remove the player 2 controls because you're using a B+ image on a model B. Here's how:

Note this guide is for my images link within my site. The guide is shown with screen shots from Porta Pi image 4.x

Turn on your Pi. When it boots into emulation station, Press F4, or quit to the terminal.

Type:

      cd Retrogame

 

then type:

         sudo nano retrogame.c

 

Scroll down to line 74-ish. You will see a section of text that looks like this:

What is this? The Inputs are the GPIO pins, The ouputs are the keyboard keys which the GPIO pins are assigned to. When a a GPIO pins goes low (a button is pressed and the circuit is closed) The Pi see's that as a keyboard press.

 

You can edit the keys to the GPIO pins as you see fit. Do not mess with the brackets or commas.

For example: Let's map GPIO pin 21 (this is my default player 2 start button) to keyboard key G. That line of code would look like:

         { 21,     KEY_G } 

Note that in this example, it's the last line of the button mapping, so there is no comma at the end.

Whatever changes you decide to make, be sure to write/save your changes to the file:
     Ctrl + O (then press enter to save to the same file name)

Exit the nano editor:

      Ctrl + X

 

Recompile the file by typing the following in the terminal:

       make

 

If you get an error that means you likely have a sytax error in your code (missing comma, bracket or the like). If you didnt get any errors, good! Reboot the Pi.

       sudo reboot

Delete Player 2 Controls (Model B)

If you need to remove or delete the Player 2 section for you model B, Delete the lower section as shown, and MAKE SURE THE LAST LINE DOES NOT HAVE A COMMA ( , ). See the picture.

Do this for BOTH sections (scroll down to see the next section).

 

Whatever changes you decide to make, be sure to write/save your changes to the file:
     Ctrl + O (then press enter to save to the same file name)

Exit the nano editor:

      Ctrl + X

 

Recompile the file by typing the following in the terminal:

       make

 

If you get an error that means you likely have a sytax error in your code (missing comma, bracket or the like). Fix your code until the make compiles without errors. Reboot the Pi. 

    sudo reboot

Update retroarch.cfg for new GPIO mapping.

If you modifed retrogame.c by adding new GPIO pins, or changed keyboard keys, we need to edit the emulator's config file to recognize these new player inputs.

 

In the terminal, load X (GUI)

startx

 

Navigate to the retroarch.cfg file. The location is: /opt/retropie/configs/all

Scroll down to the keyboard inputs. Make the changes that are required to reflect what you did in the previous steps. Save the file. Done!

 

The picture below shows where I added player two controls.  NOTE: The input pre-text for player 2 inputs is "input_player2". If you copy and paste player 1 inputs to add player 2 controls make sure you fix the player number.

 

 

Print Print | Sitemap
© 2013-2017 Ryan Bates and © 2013-2017 Retro Built Games, LLC. All photos, designs, documents, and graphics (C) Ryan Bates. All Rights Reserved.

This site is best viewed on a desktop PC. (Can't find the payment buttons? Use a desktop web browser or Request Desktop Site) Raspberry Pi is a trademark of the Raspberry Pi Foundation. ARDUINO® and other Arduino brands and logos published in the website are Trademarks of Arduino AG.