Have a light only turn on while Retropie/EmulationStation is running
-
Recently I bought the NES case for Raspberry Pi 3 from Old Skool Tools. I really like it and appreciate that it has a cutout to add a light to make it just like the original NES. In the past I have wired up a simple light but it would come on (and stay on) while the system had power, even if Retropie had finished shutting down and wasn't running.
What I really want to do is have a light come on while emulation station/retropie is running and shut off after its done shutting down (but the system is still plugged in). What is the best way to start?
-
@triquick wire the led to the bottom side of a usb port. The usb port shut off when you do the power down.
-
Maybe a PowerBlock circuit. The Pi can remain plugged while you can use a button to turn it on and off. The led will turn on and off with it (and even has certain patterns when booting and shutting down.
-
@triquick I would suggest PowerBlock as well. Check it out on this site:
https://blog.petrockblock.com/2015/07/04/powerblock-another-power-switch-for-the-raspberry-pi/ -
Would it be worth it to try to create a two scripts
- One that turns the light on, and have the Retropie startup script call it?
- One that turns off the light, and have the Retropie shutdown script to call it?
Or would that be to much of hassle dealing with updates to the startup/shutdown script?
-
Assuming that your led is powered by a GPIO pin you can write two quick programs with wiringpi to turn it on and off. Then call those programs using rc script : https://www.raspberrypi.org/documentation/linux/usage/rc-local.md
( I believe scripts for shutdown are at /etc/rc0.d )
-
@Aryetis Great, thanks, that was exactly what I was looking for.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.