Main > Raspberry Pi & Dev Board
Retropie SNES, GPIO reset switch how to.
severdhed:
i don't mind the emulation station front end...i wish pressing left/right when in a specific emulator wouldn't change to the next one, and i wish the retropie config didn't show up as another system in the list, but other than that, it works fairly well.
So i looked the link about creating these scripts, but some of it is vague..can any of you help?
1st of all, it wants me to create two files: escape.sh and escape.py and add a line to something called cron.
how do I create these files and where do I put them? my original plan was just make them in notepad, then copy them over via smb share, but when i connect to the unit via smb, i only see the roms, bios, and configs filders. I did manage to get connected to the unit via ssh using putty, but i just don't know what to do from there.
also, when it comes to wiring up the switch, how do I know how to wire it up? upon inspection of that file, it seems to possibly reference pin 17. according to a diagram i found it appears as if the 6th pin down on the left column is pin17, and the one right above it is a ground. logically i would think you would just wire the switch to these two pins, but there is a diagram on that page with a picture of the pie with a large plastic thing with a bunch of holes, several wires, a switch and what i believe is a resisitor...is that crap all necessary?
i'm trying to find a better example, but so far i'm coming up short...if you can shine some light on this , i'd appreciate it.
pbj:
Ok, I'm apparently referring to Emulation Station. Obviously designed by an engineer of some sort.
Locke141:
I think for a console emu station is fine but Atract mode is a much better looking FE and has more of an arcade feel.
What OS build are you using? Raspbian or some cut down versions of it is most likely.
.sh refers to shell and .py refers to Python.
I'm far from a LINUX power user, but if you share the like's where you are getting the guides from I'll be happy to take a look and try to help.
This may help:
https://www.rascronpberrypi.org/documentation/linux/usage/cron.md
http://cagewebdev.com/index.php/raspberry-pi-excuting-shell-scripts/
severdhed:
ok...I'm not sure which OS build it is, i downloaded the retropie v3 sd card image.
i am following the post in this link...
https://www.reddit.com/r/raspberry_pi/comments/2yw4fn/finally_set_up_retropie_complete_with_a_gpio/
that slippyblade pointed me to in the second post of this thread.
about 3/4ths of the way down the page, there is a post by b4ux1t3 that lists the instructions. it contains:
escape.py
from time import sleep
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
def exitEmulator(channel):
print('exitEmulator')
pids = [pid for pid in os.listdir('/proc') if pid.isdigit()]
for pid in pids:
try:
commandpath = open(os.path.join('/proc', pid, 'cmdline'), 'rb').read()
if commandpath[0:24] == '/opt/retropie/emulators/':
os.system('kill -QUIT %s' % pid)
print('kill -QUIT %s' % pid)
except IOError:
continue
GPIO.add_event_detect(17, GPIO.RISING, callback=exitEmulator, bouncetime=500)
while True:
sleep(10)
escape.sh
#!/bin/sh
cd /
cd /home/pi
sudo python escape.py
cd /
Add this to cron (sudo crontab -e)
@reboot sh /home/pi/escape.sh
but there were no instructions on how to do this. I eventually figured out how to create the files and here is what i did:
connected to pi via SSH using putty
cd /home
cd pi
nano escape.py
entered the contents listed in the link
saved it
nano escape.sh
entered the contents listed in the link
saved it
sudo crontab -e
entered the line listed in the link
saved it
rebooted
according to this GPIO pinout diagram, the 5th pin on the left column is a ground, and the 6th pin is GPIO17. so i connected a standard arcade microswitch to these two pins. (i used pin 17, because from what I can tell, that is the pin referenced in the script, if I am understanding it correctly)
I then launch a game and press the reset button on the console, but nothing happens.
so, what am I doing wrong? do i need to wire the switch up differently? i looked around and i see various information, some people say you need a circuit with a pull up resistor (no idea what that is).
i created an account on the site where that was originally posted and sent the original poster a message last evening....perhaps they will be able to shed some light on it. any help would be appreciated.
it isn't a huge deal breaker, i can exit the games using the start+select buttons on the gamepad, but it feels stupid to have that switch there and not serve a purpose.
Locke141:
Here's a clear explanation on how to make a pull up/down resister and an explanations on why you need one.
https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/buttons_and_switches/
--- Quote ---When a GPIO pin is set as an input it is “floating” and has no defined voltage level. For us to be able to reliably detect whether the input is high or low we need to tie it so that it is always connected and either reads high or low.
To tie the pin we connect either a Pull Up or Pull Down resistor. A Pull down resistor connects the pin to ground through a large resistor, this means that when the switch is open there is a path to ground and so it will read low. When the switch is pressed (with the other side connected to 3.3V) there is a lower resistance path to high and so the pin will read high. The large (10kΩ) resistor ensures that only a little current is drawn when the switch is pressed.
Setting up a circuit like this means that we will be able to take reliable readings from a switch, however we could still damage the pins if they are accidentally set to an output. If we drive it low the output is connected directly to ground. Pushing the button will then create a short circuit between 3.3V and ground! To make this safer we put in a current limiting resistor (1kΩ will do) to make sure the Pi can handle the current drawn.
- https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/buttons_and_switches/
--- End quote ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version