I've followed the instructions as per http://pimame.org/forum/discussion/comment/1983#Comment_1983 which if I understood correctly installs a python package which allows for shutdown and sets up a python script to shutdown upon button press.
Thanks for your help. It definitely is GPIO17 because Maplin's terminal block maps to GPIO17. I connected one end of the plunger to GPIO17 and the other to GND.
I've changed the code as follows:
import RPi.GPIO as GPIO import time import os GPIO.setmode(GPIO.BOARD) GPIO.setup(17, GPIO.IN,pull_up_down=GPIO.PUD_UP) while True: print GPIO.input(17) if(GPIO.input(17) == False): os.system("sudo shutdown -h now") break time.sleep(1)
Then saved this as shutdown.py and edited file /etc/rc.local to add: python /home/pi/bin/shutdown.py & (before last line)
Still no working...
I know that I have the pi booting straight into Mame4All by adding a line in the .profile file. Would this somehow stop the rc.local file from loading and therefore not executing the script?