Help Making Power Button with Latching Button
-
Hello! I got all of the electronics I need for an cocktail table (with a Pi 3 B+), except I bought a latching power button instead of a momentary power button, making it kind of difficult to make one easily with GPIO pins.
When I hit the button the first time, it needs to power it on. At that point the buttons is latched, so when I hit it again, it needs to shutdown properly, as not to corrupt anything
I don't want to wire it into the PSU cord because then it could cause corruption (right?).
I think this could be done pretty easily via a script, but I don't know how to implement one into RetroPie. Also I would prefer it to not need a script, but it's not an issue if it makes it work.
Does anyone know any ways to make this work without buying a new button?
Thanks, saddlepiggy
-
I used a script and a switch from mausberry circuits works great.
-
@saddlepiggy You can use the Multi Switch Shutdown Script and call it with
--generic
parameter. Then you have a basic on/off switch. It does not matter if it's latching or a momentary switch type.You can also use the device @stoney66 suggested, with the same script but with parameter
--mausberry
(imho a very good device). Works also with two types of power switchs (latching or momentary) -
@cyperghost Awesome thank you! I will definitely go with your solution!
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.