Skip to content

Instantly share code, notes, and snippets.

@wellwind
Last active August 3, 2016 13:51
Show Gist options
  • Save wellwind/15021880a4c6fc9293534e22043d6aa7 to your computer and use it in GitHub Desktop.
Save wellwind/15021880a4c6fc9293534e22043d6aa7 to your computer and use it in GitHub Desktop.
  1. Update
sudo apt-get update
sudo apt-get upgrade

sudo rpi-update
  1. reboot

  2. Enable Camera

sudo raspi-config

Enable Cameera -> Yes

  1. Set camera module to /dev/video0 when boot
sudo nano /etc/init.d/startup
#!/bin/sh

/sbin/modprobe bcm2635-v4l2
sudo chmod 755 /etc/init.d/startup
sudo update-rc.d startup defaults
  1. install zbar-tools

  2. download QRCodeReader.py

  3. Start GUI

startx
  1. run python script
python QRCodeReader.py
  1. scan QRCode
import sys
import os
p = os.popen('/usr/bin/zbarcam --prescale=300x300 --Sdisable -Sqrcode.enable', 'r')
def start_scan():
global p
while True:
print('Scanning')
data = p.readline()
qrcode = str(data)[8:]
if(qrcode):
print(qrcode)
try:
start_scan()
except KeyboardInterrupt:
print('Stop scanning')
finally:
p.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment