Another Power button question, but with a twist
Posted: Fri Mar 06, 2020 3:49 am
Hey All,
I'm only in the beginning stages of this, but I'm trying to create a TV like device that harkens back to days of yore. After a lot of painful sd card removal and replacement, adjust config.txt files to get the HDMI working on a 7" touchscreen, I got the Pi4 up and running with Buster, Lakka, and LibreELEC. I have a script I used on a Pi3 that triggers a shutdown and restart using a momentary switch connected to the GPIO. I haven't moved it onto the pi4 yet. However, in this new build, I'm hooking up a couple of 3w speakers that run through a small amplifier with a knob. The amplifier connects to the Gpio for power, and connects to the pi's onboard audio jack.
Question 1
Is there a way to use the volume knob to also be a power switch? Meaning when the knob is turned counter clockwise and clicks off, can it trigger a script to turn the pi off? Then when it turns clockwise and clicks on, it can trigger a wakeup?
Question 2
Is there a way to use a two state knob (sorry I dont know the right term here), essentially a dial that can only go right or left one place from the start, to control the power? I want to create the look of an old TV from back in the day with the dials that turned the set on.
Any help getting me in the right direction, or even help creating a script like this would be very helpful.
Thanks!
I'm only in the beginning stages of this, but I'm trying to create a TV like device that harkens back to days of yore. After a lot of painful sd card removal and replacement, adjust config.txt files to get the HDMI working on a 7" touchscreen, I got the Pi4 up and running with Buster, Lakka, and LibreELEC. I have a script I used on a Pi3 that triggers a shutdown and restart using a momentary switch connected to the GPIO. I haven't moved it onto the pi4 yet. However, in this new build, I'm hooking up a couple of 3w speakers that run through a small amplifier with a knob. The amplifier connects to the Gpio for power, and connects to the pi's onboard audio jack.
Question 1
Is there a way to use the volume knob to also be a power switch? Meaning when the knob is turned counter clockwise and clicks off, can it trigger a script to turn the pi off? Then when it turns clockwise and clicks on, it can trigger a wakeup?
Question 2
Is there a way to use a two state knob (sorry I dont know the right term here), essentially a dial that can only go right or left one place from the start, to control the power? I want to create the look of an old TV from back in the day with the dials that turned the set on.
Any help getting me in the right direction, or even help creating a script like this would be very helpful.
Thanks!