Raspberry Pi OS AudioPlayer with a Button (ADevice V 1.0)

Basic Audio Script with GPIO-Control


from time import sleep

import RPi.GPIO as GPIO

import os

import sys

GPIO.setmode(GPIO.BCM)

button1=17

GPIO.setup(button1,GPIO.IN,pull_up_down=GPIO.PUD_UP)

while(1):

if GPIO.input(button1)==0:

print "Button 1 Was Pressed:"

os.system("amixer cset numid=1 85%")

os.system("aplay /home/pi/audiobutton/button/audio.wav -D sysdefault:CARD=0")

sleep(.1)

Schreibe einen Kommentar