Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. import RPi.GPIO as GPIO
  2. import time
  3. import os
  4. import subprocess
  5.  
  6. GPIO.setmode(GPIO.BCM)
  7.  
  8. GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  9.  
  10. chiave= "Curreri Giuseppe"
  11.            while True:
  12.     input_state = GPIO.input(18)
  13.     if input_state == False:
  14.         print('Richiesta autenticazione')
  15.         os.system("sudo fswebcam -d /dev/video0 -r 1024x768 -S 50 pic.jpg")
  16.         qrcode = subprocess.run(["zbarimg --raw pic.jpg"],stdout=subprocess.PIPE,stderr=subprocess.PIPE,encoding="utf-8")
  17.         varqr = qrcode.stdout
  18.            if ( varqr == chiave ):
  19.            print("Se va imposto GPIO HIGH per comandare arduino")
  20.            else
  21.            print("qrcode incorretto")
  22.         time.sleep(0.2)
  23.  
  24. GPIO.cleanup()
  25. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement