Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO
- import time
- import vlc
- import os
- GPIO.setmode(GPIO.BOARD)
- GPIO.setwarnings(False)
- GPIO.setup(7, GPIO.IN)
- p = vlc.MediaPlayer("/home/pi/Documents/ALARM2.mp3")
- on = False
- printed = False
- motion = False
- volume = 50 #STARTING VOLUME
- try:
- while motion == False:
- print(volume)
- os.system("sudo amixer set PCM -- "+str(volume)+"%")
- p.play()
- time.sleep(3)
- p.stop()
- volume += 4
- if(volume > 100):
- volume = 100
- motion = GPIO.input(7)
- except KeyboardInterrupt:
- GPIO.cleanup()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement