play confirmation sound is scanning was successful

This commit is contained in:
2020-06-14 15:40:40 +02:00
parent 0999882d2d
commit aba8e3266a
+5 -1
View File
@@ -17,6 +17,7 @@ logging.info('Initializing')
MUSIC_BASE_DIRECTORY = "mnt/" MUSIC_BASE_DIRECTORY = "mnt/"
SOUND_SCANNING = "mnt/INTERNAL/audiorocket/sounds/scanning.mp3" SOUND_SCANNING = "mnt/INTERNAL/audiorocket/sounds/scanning.mp3"
SOUND_SCAN_FAIL = "mnt/INTERNAL/audiorocket/sounds/fail-05.mp3" SOUND_SCAN_FAIL = "mnt/INTERNAL/audiorocket/sounds/fail-05.mp3"
SOUND_SCAN_OK = "mnt/INTERNAL/audiorocket/sounds/ok-05.mp3"
QR_SCANNER_TIMEOUT = 4 QR_SCANNER_TIMEOUT = 4
# photo sensor on PIN 5 # photo sensor on PIN 5
@@ -99,6 +100,9 @@ try:
poll_result = poll_obj.poll(100) poll_result = poll_obj.poll(100)
if (poll_result): if (poll_result):
play(SOUND_SCAN_OK)
time.sleep(0.5)
qr_code = zbarcam.stdout.readline().rstrip() qr_code = zbarcam.stdout.readline().rstrip()
qr_code = qr_code.decode("utf-8") # python3 qr_code = qr_code.decode("utf-8") # python3
logging.info("QR Code: " + qr_code) logging.info("QR Code: " + qr_code)
@@ -134,4 +138,4 @@ except KeyboardInterrupt:
finally: finally:
logging.info('Reset GPIO configuration and close') logging.info('Reset GPIO configuration and close')
GPIO.cleanup() GPIO.cleanup()