-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpi5- toll.py
83 lines (69 loc) · 2.61 KB
/
pi5- toll.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from RPi import GPIO
from time import sleep
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(40,GPIO.OUT)
GPIO.setup(38,GPIO.OUT)
GPIO.setup(36,GPIO.OUT)
data=[['UP41D2002','VED GUPTA','HV',1010],['UP32J2332','JAYA TRIPATHI','LV',1010],['UP32J2232','VIKRAL SINGH','HV',1788]]
hv=300
lv=200
amount=0
def deld():
del(data[x][3])
data[x].append(r)
print('Available balance is: ',data[x][3])
while True:
GPIO.output(36,GPIO.LOW)
a=input('\nscan pls: ')
if a=='add':
print('enternthe vehicle info- ')
b=input('Enter vehicle number: ')
c=input('Name of Owner: ')
d=input('Vehicle type HV or LV: ')
e=int(input('Enter account detail: '))
dd=[b,c,d,e]
data.append(dd)
print('data successfully add!\n')
else:
for x in range(0,len(data),1):
if a in data[x]:
print('Name: ',data[x][1])
print('Vehicle no.: ',data[x][0])
print('vehicle type: ',data[x][2])
print('Amount available: ',data[x][3])
if data[x][2]=='HV':
if data[x][3]<hv:
print('BALANCE LOW')
print('balance is: ',data[x][3])
GPIO.output(36,GPIO.HIGH)
else:
r=data[x][3]-hv
amount+=100
deld()
GPIO.output(40,GPIO.HIGH)
GPIO.output(38,GPIO.LOW)
sleep(2)
GPIO.output(40,GPIO.LOW)
GPIO.output(38,GPIO.HIGH)
sleep(2)
GPIO.output(40,GPIO.LOW)
GPIO.output(38,GPIO.LOW)
elif data[x][2]=='LV':
if data[x][3]<lv:
print('BALANCE LOW')
print('balance is: ',data[x][3])
GPIO.output(36,GPIO.HIGH)
else:
r=data[x][3]-lv
amount+=200
deld()
GPIO.output(40,GPIO.HIGH)
GPIO.output(38,GPIO.LOW)
sleep(2)
GPIO.output(40,GPIO.LOW)
GPIO.output(38,GPIO.HIGH)
sleep(2)
GPIO.output(40,GPIO.LOW)
GPIO.output(38,GPIO.LOW)
print('Government balance: ',amount)