Best Practice GPIO shutdown switch
MaMikee last edited by
Did an exhaustive search for the best way to do this and saw a bunch of "OUTDATED" notices on posts, so...
I'm using the GPIO joystick interface for an Atari game (no EmulationStation) and would like to save high scores and shutdown PI.
Any suggestions on the best steps to do this?
Mike in snowy Colorado
If your start-up script executes just the Atari emulator, then you can add a 'shutdown' command in the script, right after the emulator command, so that when you exit the emulator, the system would stop.
If you'd like to use a GPIO button to shutdown the Pi system, then you can modify @cyperghost's shutdown script (https://github.com/crcerror/ES-generic-shutdown) and run it on system start to monitor a GPIO for a button press. The usual GPIO used for shutdown/start is GPIO3, since it can be used to start the PI - assuming you're using a 2 or 3B+ model.
cyperghost last edited by cyperghost
@mitu There is no modification needed at all you can use
multi-switch --genericcommand to offer an easy setup.
@MaMikee Please install
raspi-gpioat first with
sudo apt install raspi-gpiocommand. There are tons of other possibilities available ;)