-
Notifications
You must be signed in to change notification settings - Fork 0
/
LCDInternationalandmathsupermoney.ino
344 lines (264 loc) · 6.03 KB
/
LCDInternationalandmathsupermoney.ino
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
/*
Code by Dr. Harish with LCD shield on arduino for math and recreation which can be used in calculators on brick games.
*/
#include <EEPROM.h>
// include the library code:
#include <LiquidCrystal.h>
#include <math.h>
byte heart[8] =
{
0b00000,
0b01010,
0b11111,
0b11111,
0b11111,
0b01110,
0b00100,
0b00000
};
byte rupee[8] =
{
0b11111,
0b11100,
0b00010,
0b00100,
0b11111,
0b00100,
0b00010,
0b00001
};
byte smile[8] =
{
0b00000,
0b00000,
0b01010,
0b00000,
0b10001,
0b01110,
0b00000,
0b00000
};
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 8, en = 9, d4 = 4, d5 = 5, d6 = 6, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
char text[]="Jai sairam, Hare Krishna, Om shivaya";
char texttemp[50];
char text2[]="Success 90%perspiration &10%inspiration";
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
int ep=EEPROM.read(0);
randomSeed(analogRead(A1)+ep);
EEPROM.write(0,random(200));
// Print a message to the LCD.
lcd.createChar(1, heart);
lcd.createChar(2, smile);
}
void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 0);
int a;
int subtop119;
int subtop192;
a=int(random(6));
if(a==0){
lcd.print("Dr. Harish Fun $ ");}
if(a==1){
lcd.print("God is great $$ ");
}
if(a==2){
lcd.print("Om Sri Sairam $ ");
}
if(a==3){
subtop192=random(3);
if(subtop192==0){
lcd.write(1);lcd.write(' ');lcd.write(2);lcd.write(' ');lcd.write(1);lcd.write(' ');lcd.write(2);}
if(subtop192==1){
int ra=random(16);
for(int cup1=0;cup1<ra;cup1++){
lcd.write(1);
}
}
if(subtop192==2){
int ra=random(16);
for(int cup1=0;cup1<ra;cup1++){
lcd.write(2);
}
}
}
if(a==5){
subtop119=int(random(8));
if(subtop119==0){
lcd.print("Vanakkam Nandri ");}
if(subtop119==1){
lcd.print("Namaste ");}
if(subtop119==2){
lcd.print("Santhosha Aytu ");}
if(subtop119==3){
lcd.print("Guten Tag ");}
if(subtop119==4){
lcd.print("Ni hao");}
if(subtop119==5){
lcd.print("Bonjour");}
if(subtop119==6){
lcd.print("Em Kavali");}
if(subtop119==7){
lcd.print("Mrhabaan");}
}
if(a==4){
int year=random(3500)-1000;
if(year<0){
year=year*-10;
lcd.print(year);
lcd.print(" BC ");
}
else{
lcd.print(round(year*1.2));
lcd.print(" AD ");
}
}
lcd.setCursor(0, 1);
int b;
int c;
int d;
float e;
float f;
float g;
int h;
a=random(8);
if(a==0){//select sum
b=int(random(620));
c=int(random(120));
d=b+c;
lcd.print(b);
lcd.print(" + ");
lcd.print(c);
lcd.print(" = ");
delay(5000+random(2500));
lcd.print(d);
lcd.print(" ");
}
if(a==1){//select product
b=int(random(40));
c=int(random(40));
d=b*c;
lcd.print(b);
lcd.print(" * ");
lcd.print(c);
lcd.print(" = ");
delay(5000+random(2500));
lcd.print(d);
lcd.print(" ");
}
if(a==2){//select product
b=int(random(620));
c=int(random(140));
d=b-c;
lcd.print(b);
lcd.print(" - ");
lcd.print(c);
lcd.print(" = ");
delay(5000+random(2500));
lcd.print(d);
lcd.print(" ");
}
if(a==3){//select sum
f=float(random(10)+1);
g=float(random(5));
e=pow(f,g);
lcd.print(round(f));
lcd.print(" ^ ");
lcd.print(round(g));
lcd.print(" = ");
delay(5000+random(2500));
lcd.print(round(e));
lcd.print(" ");
}
if(a==4){//select sum
f=float(random(100)+1.0);
g=float(random(20)+1.0);
e=round(f/g*100.0)/100.0;
lcd.print(int(f));
lcd.print(" / ");
lcd.print(int(g));
lcd.print(" = ");
delay(5000+random(2500));
lcd.print(e);
lcd.print(" ");
}
if(a==5){//select product
b=int(random(40));
c=int(random(40));
h=int(random(20));
d=b+c-h;
lcd.print(b);
lcd.print("+");
lcd.print(c);
lcd.print("-");
lcd.print(h);
lcd.print("=");
delay(5000+random(2500));
lcd.print(d);
lcd.print(" ");
}
if(a==6){//select product
b=int(random(40));
c=int(random(40));
h=int(random(20));
d=b*c+h;
lcd.print(b);
lcd.print("*");
lcd.print(c);
lcd.print("+");
lcd.print(h);
lcd.print("=");
delay(5000+random(2500));
lcd.print(d);
lcd.print(" ");
}
if(a==7){//select product
int subind=random(7);
if(subind==0)
lcd.print("Loveall serveall ");
if(subind==1)
lcd.print("Help ever ");
if(subind==2)
lcd.print("Hurt never ");
if(subind==3)
lcd.print("Excercise daily ");
if(subind==4)
lcd.print("F=ma, v=u+at ");
if(subind==5)
lcd.print("2H2 + O2 -> 2H2O ");
if(subind==6){
unsigned int i=0;
int subsubsubind=random(2);
if(subsubsubind==0){
while(text[i]!='\0'){
lcd.print(text[i]);
if(i>=14)
{
lcd.scrollDisplayLeft(); //Scrolling text to Right
}
delay(250);
i++;
}
}
if(subsubsubind==1){
while(text2[i]!='\0'){
lcd.print(text2[i]);
if(i>=14)
{
lcd.scrollDisplayLeft(); //Scrolling text to Right
}
delay(250);
i++;
}
}
}
}
delay(3600+random(4000));
lcd.clear();
}