I'm try to play/pause mpc using a momentary push button connected on the gpio.
i guess python would do that nicely but i m just hopeless ....
the code based on other codes I found on the forums is
- Code: Select all
import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup (17, GPIO.IN)
while True:
if not GPIO.input(17):
active = 'pause'
time.sleep(.1)
if GPIO.input(17):
while active == 'pause':
os.system('mpc pause')
GPIO.output(12,False)
if not GPIO.input(17):
if GPIO.input(17):
time.sleep(.1)
active = 'pause'
else:
GPIO.output(12,True)
os.system('mpc play')
but of course doesnt work
any advice would be appreciated
Thank you