Hardware Play/Pause Button

Raspberry Pi related support

Re: Hardware Play/Pause Button

Postby rikardo1979 » 03 Jun 2016, 19:18

>>>Please always follow rules and read before you post<<<
User avatar
rikardo1979
 
Posts: 197
Joined: 10 Apr 2016, 14:34

Re: Hardware Play/Pause Button

Postby rlsten » 05 Feb 2017, 18:26

rlsten
 
Posts: 118
Joined: 25 May 2015, 18:06

Re: Hardware Play/Pause Button

Postby hondagx35 » 05 Feb 2017, 23:36

User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: Hardware Play/Pause Button

Postby rlsten » 06 Feb 2017, 15:10

rlsten
 
Posts: 118
Joined: 25 May 2015, 18:06

Re: Hardware Play/Pause Button

Postby hondagx35 » 06 Feb 2017, 17:43

User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: Hardware Play/Pause Button

Postby rlsten » 06 Feb 2017, 18:24

rlsten
 
Posts: 118
Joined: 25 May 2015, 18:06

Re: Hardware Play/Pause Button

Postby hondagx35 » 06 Feb 2017, 18:43

User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: Hardware Play/Pause Button

Postby rlsten » 06 Feb 2017, 20:09

Frank,

That was the problem! Installed python3 and everything works now.

Thanks again,
Rod
rlsten
 
Posts: 118
Joined: 25 May 2015, 18:06

Re: Hardware Play/Pause Button

Postby sam9s » 09 May 2018, 12:46

Hi All

I am, also trying to get the play pause executed to runeaudio via GPIO. When I execute the script get the error ..

#python2 hw_pause_play.py

File "hw_pause_play.py", line 21
mpc toggle
^
SyntaxError: invalid syntax

If I type mpc toggle on the command line it works but ith script it does not. Below is the script I created


Below is the script I am using ...... CAN anyone assist PLEASE!!!1



#!/usr/bin/python
import RPi.GPIO as GPIO
import time
import subprocess
GPIO.setmode(GPIO.BOARD)

# When pressed, execute this command:
print "*** Button press detected ***" # (print statement added only for debugging)
subprocess.call("mpc toggle", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PI$

# 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
sam9s
 
Posts: 1
Joined: 09 May 2018, 12:37
Location: Usa

Re: Hardware Play/Pause Button

Postby rlsten » 09 May 2018, 13:15

rlsten
 
Posts: 118
Joined: 25 May 2015, 18:06

support RuneAudio Donate with PayPal

Previous

Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 15 guests