Skip to content

Instantly share code, notes, and snippets.

@sourceperl
Created January 6, 2017 07:21
Show Gist options
  • Save sourceperl/b73595f93cdb9a2846f739544e6fe49b to your computer and use it in GitHub Desktop.
Save sourceperl/b73595f93cdb9a2846f739544e6fe49b to your computer and use it in GitHub Desktop.
QR code tools
#!/usr/bin/env python3
import os
import sys
if __name__ == '__main__':
for line in sys.stdin:
sys.stdout.write(line)
if 'keyword1' in line:
print('play bip 1')
os.system('aplay /home/pi/Music/bip1.wav >/dev/null 2>&1')
elif 'keyword2' in line:
print('play bip 2')
os.system('aplay /home/pi/Music/bip2.wav >/dev/null 2>&1')
#!/bin/bash
# read QR code from /dev/video0 send decode string to echo python script
zbarcam /dev/video0 --prescale=320x240 --raw -Sdisable -Sqrcode.enable --nodisplay | ./echo.py
#!/bin/bash
# add QR code tools
sudo apt-get install zbar-tools qrencode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment