Page 2 of 2

Re: Turn amplifier ON/OFF via relay

PostPosted: 04 Sep 2014, 15:28
by Midnight
But this one won't power off the RPi ;)

Re: Turn amplifier ON/OFF via relay

PostPosted: 04 Sep 2014, 15:43
by cmh714
Midnight wrote:But this one won't power off the RPi ;)

Fair enough, I did not look that far Midnight. TY :)

Re: Turn amplifier ON/OFF via relay

PostPosted: 19 Apr 2016, 22:00
by frengo

I read the thread thinking it were a system to power cycle an audio amplifier or other analog parts of the system, but I understand that we are talking about turning on / off the raspberry.

Do you know if someone has made a script to change how you want the logic state at will of one or more outputs of the GPIO connector, maybe on ODROID C1 +?

Thank you.

Re: Turn amplifier ON/OFF via relay

PostPosted: 27 Aug 2016, 20:45
by Eph
I wrote a simple script "" to toggle the state of one GPIO connected to a relay that toggle the power to my DAC. This works
however I fill my implementation into the WebUI is sloppy at best. I compaired cyber7 "Volume Fade Over Time" to the unmodified webui.

Would someone give me an example of how to properly execute
sysCmdAsync('sh /var/www/command/');
whiten /srv/http/app/templates/header.php
without redirecting or any popups? just a click and execute, no feedback on the current state needed.
Can a function be implemented directly in header.php?

As it is, I added
<li class="<?=$this->uri(1, 'dac', 'active')?>"><a href="/dac/"><i class="fa fa-power-off"></i> DAC Power</a></li>
to header.php
I'm calling another dac.php and having that execute and redirect back. this is noticeable on mobile devices, as it's opening a new window. sloppy, I won't pretend to know php at all.

Code: Select all
<div id="menu-top">
    <div class="dropdown">
        <a id="menu-settings" class="dropdown-toggle" role="button" data-toggle="dropdown" data-target="#" href="#">MENU <i class="fa fa-bars dx"></i></a>
        <ul class="dropdown-menu" role="menu" aria-labelledby="menu-settings">
            <li class="<?=$this->uri(1, '', 'active')?>"><a href="/"><i class="fa fa-play"></i> Playback</a></li>
            <li class="<?=$this->uri(1, 'sources', 'active')?>"><a href="/sources/"><i class="fa fa-folder-open"></i> Sources</a></li>
            <li class="<?=$this->uri(1, 'mpd', 'active')?>"><a href="/mpd/"><i class="fa fa-cogs"></i> MPD</a></li>
            <li class="<?=$this->uri(1, 'settings', 'active')?>"><a href="/settings/"><i class="fa fa-wrench"></i> Settings</a></li>
            <li class="<?=$this->uri(1, 'network', 'active')?>"><a href="/network/"><i class="fa fa-sitemap"></i> Network</a></li>
            <li class="<?=$this->uri(1, 'debug', 'active')?>"><a href="/debug/"><i class="fa fa-bug"></i> Debug</a></li>
            <li class="<?=$this->uri(1, 'credits', 'active')?>"><a href="/credits/"><i class="fa fa-trophy"></i> Credits</a></li>
            <li class="<?=$this->uri(1, 'dac', 'active')?>"><a href="/dac/"><i class="fa fa-power-off"></i> DAC Power</a></li>
            <li><a href="#poweroff-modal" data-toggle="modal"><i class="fa fa-power-off"></i> Turn off</a></li>
    <div class="playback-controls">   
        <button id="previous" class="btn btn-default btn-cmd" title="Previous" data-cmd="previous"><i class="fa fa-step-backward"></i></button>
        <button id="stop" class="btn btn-default btn-cmd" title="Stop" data-cmd="stop"><i class="fa fa-stop"></i></button>
        <button id="play" class="btn btn-default btn-cmd" title="Play/Pause" data-cmd="play"><i class="fa fa-play"></i></button>
        <button id="next" class="btn btn-default btn-cmd" title="Next" data-cmd="next"><i class="fa fa-step-forward"></i></button>
    <a class="home" href="/"><img src="<?=$this->asset('/img/logo.png')?>" class="logo" alt="RuneAudio"></a>

This calls dac.php which includes:
Code: Select all
<div class="container credits">
<form action="/dac/" method="post">
        <h2><b>Toggeling DAC Power </b><?php
                        $myscript= sysCmdAsync('sh /var/www/command/');

  <meta http-equiv="refresh" content="0;url=/">

001.jpg (26.97 KiB) Viewed 854 times

002.jpg (104.81 KiB) Viewed 854 times

003.jpg (129.57 KiB) Viewed 854 times

Yes, this is old tech. it was my Grammy's. So many records, so many memories... and now it's brought up to date with AirPlay, webradio, and NAS thanks to all the hard work from the Devs @ RuneAudio, cyber7's example in fade over time :) and the creator of RPI's
It's a good time to be alive.

Re: Turn amplifier ON/OFF via relay

PostPosted: 27 Dec 2016, 14:34
by rern