初心者です。わからないことがあるので教えていただきたいです。raspberry piでコールバック関数というものがあることはわかったのですが、以下の2つを組み合わせて、音がなってから写真を撮るというプログラムを作りたいのですが可能でしょうか?
def my_callback(channel):
global isPlaying
global process
if channel==24:
if isPlaying == False:
isPlaying = True
args = ['mpg321', 'test.mp3']
process = subprocess.Popen(args)
else:
isPlaying = False
args = ['kill', str(process.pid)]
subprocess.Popen(args)
def my_callback(channel):
if channel==10:
d = datetime.datetime.today()
filename = "{0}{1:02d}{2:02d}{3:02d}{4:02d}{5:02d}.jpg".format(d.year, d.month, d.day, d.hour, d.minute, d.second)
args = ['raspistill', '-o', filename, '-t', '1']
subprocess.Popen(args)
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。