I am attempting to create a button on my Retro Pie emulator case (A gutted NES), using the old reset switch, to exit out the of current game and go back to the menu.
Then I realized it just required a simple click of the escape key so I wrote code to emulate that.
import uinput
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN)
device = uinput.Device([uinput.KEY_ESC])
while True:
if GPIO.input(17) == True:
device.emit.click(uinput.KEY_ESC)
time.sleep(1)
I then put it in the rc.local file with the following command
sudo python /home/pi/BootScripts/reset.py &
it does not work at start up, but i did test the code by just running it through command line and looking at the output.
When I boot up I get the following error.
startpar service(s) returned failure reset.py
Can anyone help, this is driving me insane! I have never had so much trouble on such a simple thing. It probably doesn't help I had zero python experience when i started this, but, any ideas?
dmesg
output and link to it here? – RPi Awesomeness Sep 7 '14 at 12:32