Okay, so I am building a sweet vintage style boombox for my nana using a RCA Victor X551 case, a Rpi3, running runeaudio. I have most of everything figured out, but could use some help with the programming end. I have a python file which will play/pause the audio, but I don't have it actually working. I don't understand where to place the file, or what it needs to run as a "service"?
Here is my file:
!/usr/bin/env python
import RPi.GPIO as GPIO
import time
import subprocess
GPIO.setmode(GPIO.BOARD)
# Select unused GPIO header pin to be used to toggle play/pause
InputPin = 13
# Set selected pin to input, and enable internal pull-up
GPIO.setup(InputPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# Wait for a button press on the selected pin (pulled to ground, falling edge)
GPIO.wait_for_edge(InputPin, GPIO.FALLING)
# When pressed, toggle play/pause
mpc toggle
note: I stole this from someone who posted it on the runeaudio forums. I don't understand it. Is like 1 what I am looking for? subprocess?
I also have a rotary encoder which I would like to use as volume control. I am new to all this maker stuff, and any help sure would be appreciated. I do know the mpc commands I would like to use... but that's about it.