Thank you for your donation!


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


power control an external amplifier
#4
(09-28-2021, 07:56 PM)Tim Curtis Wrote:
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

Example script

I think it would be nice to add an on/off switch to the main menu (e.g. above the "Power" option), and once moOde done booting up, use this switch to turn the amp on or off as you like.
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 usename8 - 04-10-2022, 08:12 AM

Forum Jump: