-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLCDFUNandteach2.ino
87 lines (72 loc) · 1.89 KB
/
LCDFUNandteach2.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
/*
Code by Dr. Harish with LCD shield to display random sentances and revise math!
Can be used in schools and homes! Costs 1000 re to make and can be sold @ 1250 with profit or hobbyists can make it..
Can add school or home name in sentances which come up..
Auto problems display in scientific calculators based on a button like this code would be a great sale including integrands exponents etc.
*/
// include the library code:
#include <LiquidCrystal.h>
// 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);
void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
randomSeed(analogRead(0));
}
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;
a=int(random(3));
if(a==0){
lcd.print("Dr. Harish Fun ");}
if(a==1){
lcd.print("God is great ");
}
if(a==2){
lcd.print("Om Sri Sairam ");
}
lcd.setCursor(0, 1);
int b;
int c;
int d;
a=int(random(3));
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(" = ");
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(" = ");
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(" = ");
lcd.print(d);
lcd.print(" ");
}
delay(3000+random(3000));
}