Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


power control an external amplifier
#2
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.

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.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Messages In This Thread
power control an external amplifier - by kus0901 - 09-28-2021, 04:20 PM
RE: power control an external amplifier - by Tim Curtis - 09-28-2021, 07:56 PM

Forum Jump: