-
Notifications
You must be signed in to change notification settings - Fork 1
/
HN2.py
37 lines (34 loc) · 1 KB
/
HN2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import RPi.GPIO as GPIO
from time import sleep
import Servo
import read_plate as detect
import LCD
import firestore
GPIO.setmode(GPIO.BCM)
GPIO.setup(25, GPIO.IN) #in
GPIO.setup(22, GPIO.IN) #servo
track = 0
status = False
while True:
sensorIn = GPIO.input(25)
sensorTracking = GPIO.input(22)
if sensorIn == 0 and track == 0:
print("Fuck")
plate = detect.get_plate()
if plate != "":
status = firestore.getInfoByPlate(plate)
if status != False:
moneyBack = status["money"] - 5000
firestore.updateDB(plate, moneyBack, status["status"])
sleep(0.1)
Servo.openServo()
LCD.LCD(plate)
track = track + 1
else: LCD.LCD("Bien so ko hop le")
else: LCD.LCD("Bien so ko hop le")
if sensorTracking == 0 and track == 1:
track = 0
if sensorIn == 1 and sensorTracking == 1 and track == 0:
Servo.closeServo()
print("This is 0")
sleep(0.1)