Hey alle zusammen,
ich hab angefangen mit meinem PI ein Soundboard zu realisieren und habe mir dazu dieses Tutorial genommen: http://makezine.com/projects/make-33/simple-soundboard/
ZitatAlles anzeigenimport pygame.mixer
from time import sleep
import RPi.GPIO as GPIO
from sys import exit
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN)
GPIO.setup(24, GPIO.IN)
GPIO.setup(25, GPIO.IN)
pygame.mixer.init(48000, -16, 1, 1024)
sndA = pygame.mixer.Sound("buzzer.wav")
sndB = pygame.mixer.Sound("clap.wav")
sndC = pygame.mixer.Sound("laugh.wav")
soundChannelA = pygame.mixer.Channel(1)
soundChannelB = pygame.mixer.Channel(2)
soundChannelC = pygame.mixer.Channel(3)
print "Soundboard Ready."
while True:
try:
if (GPIO.input(23) == True):
soundChannelA.play(sndA)
if (GPIO.input(24) == True):
soundChannelB.play(sndB)
if (GPIO.input(25) == True):
soundChannelC.play(sndC)
sleep(.01)
except KeyboardInterrupt:
exit()
Wenn ich dann meine soundboard.py ganz normal aufrufe funktioniert alles perfekt.
Jetzt wollte ich das ganze aber so haben dass das Script automatisch gestartet wird.
Also habe ich wie hier im Forum beschrieben die rc.local. file bearbeitet.
Neustart und siehe da, die Meldung "Sampler Ready" erscheint sogar.
Drücke ich allerdings jetzt auf einen der Taster erscheint nicht der festgelegte Sound, sondern es ertönt nur ein "bzzzz".
Was habe ich falsch gemacht?
Problem ist nun auch: Wie komme ich da wieder raus?
Vielen Dank schonmal für die Antworten!