-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCHECKBAL_code.ino
More file actions
89 lines (84 loc) · 1.41 KB
/
Copy pathCHECKBAL_code.ino
File metadata and controls
89 lines (84 loc) · 1.41 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
bool checkbalance()
{
int y=0;
while(y<=balid)
{
if(balance[y]==code)
{
if(amt[y]>=50)
return true;
else
return false;
}
else if(y==balid)
{
balance[balid] = code;
balid++;
return false;
}
y++;
}
}
void addbalance()
{ int y=0;
int z=0;
int d=100;
Keypad keypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
lcd.clear();
lcd.print("Enter The Recharge");
lcd.setCursor(0,1);
lcd.print("Amount>99");
delay(3000);
lcd.clear();
lcd.print("Rupee: ");
char customKey;
int i=0;
while(balance[y]!=code)
y++;
while(i<3)
{
while(customKey == NO_KEY)
{
customKey = keypad.getKey();
}
if(customKey != NO_KEY)
{
int r = (customKey - '0');
z = (r*d) + z;
d=d/10;
}
Serial.println(customKey);
lcd.write(customKey);
i++;
customKey = NO_KEY;
}
amt[y]+=z;
for(int j=0;j<4;j++)
{
Serial.print("\n amount left is : ");
Serial.print(amt[j]);
}
}
int deductbalance(unsigned long int t,int x=1)
{ int y=0;
int sec=((t/1000));
int rate = sec/2;
for(int j=0;j<4;j++)
{
Serial.print("\nbalance is : ");
Serial.print(balance[j]);
}
for(int j=0;j<4;j++)
{
Serial.print("\n amount left is : ");
Serial.print(amt[j]);
}
if(x==1)
{
while(balance[y]!=code)
y++;
amt[y] = amt[y]-rate;
}
else if(x==0)
return rate;
}