Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import RPi.GPIO as GPIO
- import time
- import subprocess
- import alsaaudio
- # we will use the pin numbering to match the pins on the Pi, instead of the
- # GPIO pin outs (makes it easier to keep track of things)
- GPIO.setmode(GPIO.BOARD)
- # use the same pin that is used for the reset button (one button to rule them all!)
- GPIO.setup(12, GPIO.IN, pull_up_down = GPIO.PUD_UP)
- m = alsaaudio.Mixer('PCM')
- m.setvolume(100)
- while True:
- #grab the current button state
- buttonState1 = GPIO.input(12)
- # check to see if button has been pushed
- if buttonState1 != False:
- if m.getmute()[0] == 0:
- m.setmute(0)
- else:
- m.setmute(1)
- time.sleep(.1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement