I was wondering that myself, not sure exactly how to do that…
Or if there was a better way to watch for the pins… The original is a bash script:
#this is the GPIO pin connected to the lead on switch labeled OUT
#this is the GPIO pin connected to the lead on switch labeled IN
echo "$GPIOpin1" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio$GPIOpin1/direction
echo "$GPIOpin2" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio$GPIOpin2/direction
echo "1" > /sys/class/gpio/gpio$GPIOpin2/value
while [ 1 = 1 ]; do
if [ $power = 0 ]; then
Which ROMs are you experiencing problems with when this script is running? I’m using the same poweroff circuit, but I haven’t put any serious play time into any one ROM yet so I’m wondering what triggers it.
You could potentially try sleeping longer than one second to check the status of the pin. Maybe bump it up to like 10 seconds or so. Yes, your shutdown could take 10 seconds longer to complete, but that would probably be worth it if it didn’t interfere with your game play.
Shadowgate was the NES game I noticed it immediately with… The music is all distorted and choppy…Mario is fine, till you get going quickly and there are several enemies… SNES games are worse… It almost undos the mid level over-clock…
Bumping the sleep up higher helps, Shadowgate is not as choppy, but it is noticeable enough still that you can hear in the music when it recycles… What I have not tried yet is seeing if I increase the sleep and if bumping the over-clock a little more will help…
I posted on the raspberry pi forums as well and it was suggested there that I look into finding a script that does the same but uses polling or interrupts and it not BASH based… So I am going to explore that as well…