-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathREADID_code.ino
More file actions
155 lines (147 loc) · 2.35 KB
/
Copy pathREADID_code.ino
File metadata and controls
155 lines (147 loc) · 2.35 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
int h=0;
void readid()
{
h=0;
if(s==0)
{
while(p<10)
{
a[p]="";
p++;
}
s++;
}
int l=0,j=0,c=0,k=0,x=0,f=0,m=0,flag=0;
p=0;
while(a[p]!= "")
{
p++;
x++;
}
//TO SEARCH IF SCANNED CARD IS PRESENT OR NOT
for(k=0;a[k]!="";k++)
{
if(a[k]==code)
c=1;
}
k=0;
if(c==1)
{
g--;
while(a[l]!= "")
{
if(a[l]==code)
{
lcd.clear();
int j=0;
for(j=0;j<4;j++)
{
if(balance[j]==code)
{
ending1[j]=millis();
break;
}
}
Serial.print("ending is : ");
Serial.print(ending1[j]);
unsigned long int ellapsed = ending1[j] - start1[j];
showTime(ellapsed);
int rate = deductbalance(ellapsed,0);
lcd.clear();
lcd.print("You Were Charged");
lcd.setCursor(0,1);
lcd.print(rate);
lcd.print("Rupees");
delay(3000);
lcd.clear();
lcd.print("Thank You!!");
lcd.clear();
//digitalWrite(A2,HIGH);
//digitalWrite(A2,LOW);
//digitalWrite(A2,HIGH);
//digitalWrite(A2,LOW);
//digitalWrite(A2,HIGH);
//digitalWrite(A2,LOW);
flag=1;
a[l]="";
f=l;
x--;
}
l++;
}
l=f;
k=f+1;
}
if(flag==1)
{
while(a[k]!="")
{
a[l]=a[k];
k++;
l++;
h++;
}
a[l]="";
}
if(c==0)
{
a[p]=code;
lcd.clear();
lcd.print("Checking Balance...");
if(!checkbalance())
{
for(int j=0;j<4;j++)
{
Serial.print("\nbalance is : ");
Serial.print(balance[j]);
}
for(int j=0;j<4;j++)
{
Serial.print("\namount lest is : ");
Serial.print(amt[j]);
}
delay(2000);
lcd.setCursor(0,1);
lcd.print("LOW BALANCE!!");
delay(2000);
addbalance();
}
else
{
for(int j=0;j<4;j++)
{
Serial.print("\namount lest is : ");
Serial.print(amt[j]);
}
delay(2000);
lcd.setCursor(0,1);
lcd.print("SUFFICIENT BALANCE!!");
delay(2000);
}
for(int j=0;j<4;j++)
{
if(balance[j]==code)
start1[j]=millis();
}
Serial.print("Starting is : ");
Serial.print(start1[j]);
m=1;
lcd.clear();
lcd.print("You Are Exisitng");
lcd.setCursor(0,1);
lcd.print("User!!");
lcd.clear();
lcd.print("Welcome!!");
digitalWrite(A2,HIGH);
delay(500);
digitalWrite(A2,LOW);
delay(3000);
int w=0;
while(w<=4)
{
Serial.print("\nARRAY : ");
Serial.print(a[w]);
w++;
}
}
}