Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO
- import time
- import os
- import subprocess
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
- chiave= "Curreri Giuseppe"
- while True:
- input_state = GPIO.input(18)
- if input_state == False:
- print('Richiesta autenticazione')
- os.system("sudo fswebcam -d /dev/video0 -r 1024x768 -S 50 pic.jpg")
- qrcode = subprocess.run(["zbarimg --raw pic.jpg"],stdout=subprocess.PIPE,stderr=subprocess.PIPE,encoding="utf-8")
- varqr = qrcode.stdout
- if ( varqr == chiave ):
- print("Se va imposto GPIO HIGH per comandare arduino")
- else
- print("qrcode incorretto")
- time.sleep(0.2)
- GPIO.cleanup()
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement