ryangodammit wrote: 
> Has anyone integrated gpio buttons to pcp?
> I would love to have a physical pause button on my system

Hi ryangodammit,

Yes it has been done, but I can't find an appropriate link for you. :(

Here is a very basic example I used for testing purposes.


Code:
--------------------
    #!/bin/sh
  
  # Play/stop Squeezelite
  # Push button connected to GPIO17
  
  player=started
  
  echo "17" > /sys/class/gpio/export
  echo "in" > /sys/class/gpio/gpio17/direction
  
  while true
  do
        PRESSED=$(cat /sys/class/gpio/gpio17/value)
        echo $PRESSED
        sleep 1
        if [ $PRESSED = 0 ]; then
                if [ $player = stopped ]; then
                        echo "Start player"
                        echo "play" | telnet 192.168.1.101:9090
                        player=started
                        sleep 3
                else
                        echo "Stop player"
                        echo "stop" | telnet 192.168.1.101:9090
                        player=stopped
                        sleep 3
                fi
        fi
  done
  
  echo "17" > /sys/class/gpio/unexport
  
  exit
  
--------------------


Then there are decisions to make about:
    
- polling or interrupts
- shell script or python
- use wiringPi or not
  

Here are some "out" examples, that might give you a few more ideas.

http://www.pinkfishmedia.net/forum/showthread.php?t=165465&highlight=neat

The "Audiophonics-powerscript.tcz" extension has a script.

regards
Greg


------------------------------------------------------------------------
Greg Erskine's Profile: http://forums.slimdevices.com/member.php?userid=7403
View this thread: http://forums.slimdevices.com/showthread.php?t=107352

_______________________________________________
unix mailing list
unix@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to