Adding Arcade Controls

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
bluehawk301
 
Posts: 7
Joined: Fri Jun 13, 2014 8:17 pm

Adding Arcade Controls

Post by bluehawk301 »

Hi.
I am trying to add arcade controls to my Raspberry Pi for use with Retropie and I am following the tutorial at:
https://learn.adafruit.com/retro-gaming ... pi/buttons
I downloaded the file but when I type "make" into the Terminal, it gives me the executable, but I cannot run it from the Terminal. I have no idea what I am doing wrong, or how to fix it.
I have the arcade button (https://www.adafruit.com/products/476) wired to the GPIO 23 and the GND right next to it with the quick connect cable.
Thank you in advance for a quick and helpful response.

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Adding Arcade Controls

Post by pburgess »

What's the exact error message you're getting when you try to run it?

Keep in mind you have to run it as root (using the sudo command) and include "./" in the filename when you're in the same directory as the executable. i.e.:

Code: Select all

sudo ./retrogame
If that works, you can then edit /etc/rc.local as shown in the guide to make it run automatically at startup.

bluehawk301
 
Posts: 7
Joined: Fri Jun 13, 2014 8:17 pm

Re: Adding Arcade Controls

Post by bluehawk301 »

It says "command: './retrogame' not found".

bluehawk301
 
Posts: 7
Joined: Fri Jun 13, 2014 8:17 pm

Re: Adding Arcade Controls

Post by bluehawk301 »

UPDATE:
I re installed two more times and on the final time it worked!

KiT
 
Posts: 2
Joined: Sun Jun 02, 2013 7:18 pm

Re: Adding Arcade Controls

Post by KiT »

I'm stuck at this error: It says sudo: ./retrogame: command not found

I first tried to build my own but the make errors out as well with error: pi@raspberrypi ~/Adafruit-Retrogame $ make
gcc -Wall -O3 -fomit-frame-pointer -funroll-loops -s gamera.c -lncurses -lmenu -lexpat -o gamera
gamera.c:71:21: fatal error: ncurses.h: No such file or directory

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Adding Arcade Controls

Post by pburgess »

sudo apt-get install ncurses-dev libexpat1-dev
Then make (or make CFLAGS=-DCUPCADE if using the Cupcade pinout)
sudo ./retrogame to test
sudo make install to move executables to /usr/local/bin

Hirt
 
Posts: 4
Joined: Mon Jul 21, 2014 8:45 am

Re: Adding Arcade Controls

Post by Hirt »

Hello,

I am trying to follow the tutorial https://learn.adafruit.com/retro-gaming ... i/overview

So here what I have done so far :
* Installed the latest version of Raspbian http://www.raspberrypi.org/downloads/ (June 2014)
* Installed ncurses-dev libexpat1-dev
* Installed mame4all from https://code.google.com/p/mame4all-pi/ As it is just an unzip file I put it in /home/pi/mame4all
* Installed Adafruit-Retrogane-master (I didn't remane it Adafruit-Retrogane as I don't think it matter) Again in /home/pi/Adafruit-Retrogane-master and use make. I am using juste on Joystick and 2 buttons so I didn't not modified retrogame.c
* Of course add the line sudo modprobe uinput ; sudo sh -c 'echo uinput >> /etc/modules'

Unfortunately when I do sudo ./retrogame Only right and left from the joystick do [[C^ or [[D^

This is the third time I try from the build of the system, once I also had joystick up but never any buttons nor joystick down.

I am starting to think of a problem on the pin from the raspberry or the joystick so i'll try to change the retrogame.c in order to try joystick up and down on other pin but on the same time I was seeking for some help to know if I was doing something wrong on my installation.

So if any one has any idear on what I could look a bit more to move forward I would be glad to hear it.

Thank you.

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Adding Arcade Controls

Post by pburgess »

If you're getting at least some output from the joystick, that's encouraging...it means the code is running and this is just a wiring problem. We can help untangle it.

Post picture(s) with a clear view of the connections between the controls and the Raspberry Pi. Also, if you can copy-and-paste your io[] array from retrogame.c, we'll check that the two match.

What version of Raspberry Pi board are you using? V1 (no mounting holes), V2 (two mounting holes) or B+ (four holes)?

Hirt
 
Posts: 4
Joined: Mon Jul 21, 2014 8:45 am

Re: Adding Arcade Controls

Post by Hirt »

Hello,

First of all I'm using a raspberry V2.

I am pretty sure the first wiring I done was an exact copies of the tutorial.

So I tryed to change every thing :

Button 1 : GPIO17 + GND (pin 09+11) (Only one working)
Button 2 : GPIO24 + GND (pin 18+20)
Joystick Left : Blue wire GPIO2 (pin 3)
Joystick Right : Purple wire GPIO3 (pin 3)
Joystick Up : Gray wire GPIO22 (pin 3)
Joystick Down : White wire GPIO11 (pin 3)
Joystick GND : pin 6

Here the code from retrogame.c


#ifdef CUPCADE
// Use this table for the Cupcade project (w/PiTFT).
// To compile, type: make clean; make CFLAGS=-DCUPCADE
{ 2, KEY_LEFT }, // Joystick (4 pins)
{ 3, KEY_RIGHT },
{ 4, KEY_DOWN },
{ 17, KEY_UP },
{ 27, KEY_Z }, // Fire/jump/primary
{ 22, KEY_X }, // Bomb/secondary
{ 23, KEY_R }, // Credit
{ 18, KEY_Q } // Start 1P
// MAME must be configured with 'z' & 'x' as buttons 1 & 2 -
// this was required for the accompanying 'menu' utility to
// work (catching crtl/alt w/ncurses gets totally NASTY).
// Credit/start are likewise moved to 'r' & 'q,' reason being
// to play nicer with certain emulators not liking numbers.
// GPIO options are 'maxed out' with PiTFT + above table.
// If additional buttons are desired, will need to disable
// serial console and/or use P5 header. Or use keyboard.
#else
// Use this table for the basic retro gaming project:
{ 2, KEY_LEFT }, // Joystick (4 pins)
{ 3, KEY_RIGHT },
{ 22, KEY_UP },
{ 9, KEY_DOWN },
{ 24, KEY_LEFTCTRL }, // Fire/jump/primary
{ 17, KEY_LEFTALT } // Bomb/secondary
// For credit/start/etc., use USB keyboard or add more buttons.
#endif

User avatar
Bel_Z_Bub
 
Posts: 263
Joined: Wed Jun 04, 2014 1:58 pm

Re: Adding Arcade Controls

Post by Bel_Z_Bub »

whats in advmame.rc or advmame.rc.common?

also I dont see GPIO11 mapped anywhere in retrogame.c

Hirt
 
Posts: 4
Joined: Mon Jul 21, 2014 8:45 am

Re: Adding Arcade Controls

Post by Hirt »

I found one pin that was working. So I tryed one by one all the directions from the joystick and both buttons and they all work fine.
Then I came back to the conf where I had 3 directions working and tryed other pine one by one to finely having the joystick working.

So either I have "dead" gpio pins on my brand new raspberry or using a wrong version of raspberry.

Hirt
 
Posts: 4
Joined: Mon Jul 21, 2014 8:45 am

Re: Adding Arcade Controls

Post by Hirt »

Finely the issue isn't really an issue.

It is just that the buttons were mapped to the key ALT and CRTL which do nothing via ./retrogame and so made me think it was not working.

Thank you for you help.

User avatar
Bel_Z_Bub
 
Posts: 263
Joined: Wed Jun 04, 2014 1:58 pm

Re: Adding Arcade Controls

Post by Bel_Z_Bub »

lol thats why I asked what was in the advmame.rc files, the joystick shouldnt put out [[C^ :) good you got it sorted

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”