Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import subprocess
- import time
- while True:
- #controlla distanza
- distance = subprocess.check_output("python /home/pi/Documents/programma/distancesensor.py", shell=True)
- distance = distance.replace('.0\n', '')
- distance = int(distance)
- if (distance < 35):
- #se distanza < 35 cm fai foto
- subprocess.call("python /home/pi/Documents/programma/camera.py", shell=True)
- #estrae targa
- targa_letta = subprocess.check_output("alpr -c eu -n 5 /home/pi/Documents/opencv4/Plate/photo.jpeg", shell = True)
- print (targa_letta)
- #recupera targa
- targa_sblocco = subprocess.check_output("cat /home/pi/Documents/targa.txt", shell=True)
- #elimina caratteri superflui
- targa_sblocco = targa_sblocco.replace (' ', '')
- targa_sblocco = targa_sblocco.replace ('\n', '')
- #confronto targa
- if targa_letta.find(targa_sblocco) != -1:
- #print ("Corrisponde")
- #movimento dissuasore
- subprocess.call("python /home/pi/Documents/programma/movimento.py", shell=True)
- time.sleep(2)
Advertisement
Add Comment
Please, Sign In to add comment