-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwallet.cpp
More file actions
116 lines (107 loc) · 2 KB
/
Copy pathwallet.cpp
File metadata and controls
116 lines (107 loc) · 2 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
#include<SoftwareSerial.h>
#include<LiquidCrystal.h>
#include<String.h>
int a,b;
int index,fi;
String amount;
//String arr[2]={"10004B23B7CF","10004A87F62B"};
int cost=1000;
const int rs = 2, en = 3, d4 = 4, d5 = 5, d6 = 6, d7 = 9;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int i,flag=0;
SoftwareSerial myserial(8,9);
unsigned char count=0;
String input,abc;
//char tag[]="10004B23B7CF";
void setup()
{
Serial.begin(9600);
myserial.begin(9600);
lcd.begin(16,2);
}
void loop()
{
a=0;
lcd.clear();
lcd.setCursor(2,0);
lcd.print("WELCOME TO");
lcd.setCursor(5,1);
lcd.print("BNMIT");
if(myserial.available())
{
input=myserial.readString();
//Serial.print(input);
a=1;
//index=i;
displayaccess();
Serial.print("Enter cost:");
delay(5000);
amount=Serial.readString();
// b=(int)amount;
b=amount.toInt();
Serial.println(b);
cost=cost-b;
Serial.print("Balance amount=");
Serial.println(cost);
lcd.clear();
lcd.print("Balance=");
lcd.print(cost);
lcd.println("Rs. ");
delay(2000);
}
delay(2000);
}
void displayaccess()
{
lcd.clear();
flag=1;
lcd.print("Balance=");
lcd.print(cost);
lcd.println("Rs. ");
a=0;
}
void displaynoaccess()
{
lcd.clear();
Serial.println("UNAUTHORIZED ACCESS");
lcd.print("UNAUTHORIZED");
lcd.setCursor(0,1);
lcd.print("ACCESS");
a=0;
}
int convert(String k)
{
Serial.print(k);
char ch;
int l[100];
int j=0;
int sum=0;
int len=k.length();
for(int i=0;i<len;i++)
{
ch=k[i];
l[i]=(int)ch-48;
Serial.println(l[i]);
}
Serial.println();
for(int i=0;i<len;i++)
{
sum=sum*10+l[i];
}
return sum;
}