09-28-2021, 07:56 PM
(This post was last modified: 09-28-2021, 08:27 PM by Tim Curtis.
Edit Reason: ETA
)
The challenge is that there are many different scenarios for Amp On/Off. For example below is a script that can handle 2 Amps. IIRC it was run from some selections on the main Menu. Other users want the Amp to turn off when Menu, Power, Shutdown. Other requests I've seen are to turn the Amp off after a delay when music has stopped playing or turn it off based on Clock Radio off time.
If the feature could be generalized to easily accommodate the different usage scenarios it would prolly be something that could be added to moOde.
ETA: Added the example script.
Code:
#!/bin/bash
# Initialize GPIOs
if [[ $1 = "init" ]]; then
/usr/local/bin/gpio -g mode 23 out
/usr/local/bin/gpio -g mode 24 out
exit
fi
# Switch On/Off
if [[ $1 = "switch" ]]; then
# Amp 1
if [ $2 = "On" ]; then
/usr/local/bin/gpio -g write 23 1
fi
if [ $2 = "Off" ]; then
/usr/local/bin/gpio -g write 23 0
fi
# Amp 2
if [ $3 = "On" ]; then
/usr/local/bin/gpio -g write 24 1
fi
if [ $3 = "Off" ]; then
/usr/local/bin/gpio -g write 24 0
fi
exit
fi
If the feature could be generalized to easily accommodate the different usage scenarios it would prolly be something that could be added to moOde.
ETA: Added the example script.