Greifent

Main

Feb 27th, 2020
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. #!/usr/bin/python
  2. import subprocess
  3. import time
  4.  
  5. while True:
  6.     #controlla distanza
  7.     distance = subprocess.check_output("python /home/pi/Documents/programma/distancesensor.py", shell=True)
  8.     distance = distance.replace('.0\n', '')
  9.     distance = int(distance)
  10.     if (distance < 35):
  11.         #se distanza < 35 cm fai foto
  12.         subprocess.call("python /home/pi/Documents/programma/camera.py", shell=True)
  13.         #estrae targa
  14.         targa_letta = subprocess.check_output("alpr -c eu -n 5 /home/pi/Documents/opencv4/Plate/photo.jpeg", shell = True)
  15.         print (targa_letta)
  16.         #recupera targa
  17.         targa_sblocco = subprocess.check_output("cat  /home/pi/Documents/targa.txt", shell=True)
  18.         #elimina caratteri superflui
  19.         targa_sblocco = targa_sblocco.replace (' ', '')
  20.         targa_sblocco = targa_sblocco.replace ('\n', '')
  21.         #confronto targa
  22.         if targa_letta.find(targa_sblocco) != -1:
  23.             #print ("Corrisponde")
  24.             #movimento dissuasore
  25.             subprocess.call("python /home/pi/Documents/programma/movimento.py", shell=True)
  26.     time.sleep(2)
Advertisement
Add Comment
Please, Sign In to add comment