Repository navigation
Expand file tree
/
Copy pathsrc
More file actions
129 lines (107 loc) · 3.85 KB
/
Copy pathsrc
File metadata and controls
129 lines (107 loc) · 3.85 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
//include library code
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//declare global variables
int level = 0;
String lastQuestion;
//declare delay function
void delaySequence(){
delay(3000);
lcd.clear();
delay(1000);
}
//function to print up to 32 characters on both rows printText("text you want to print")
void printText(String x){
int i;
char a[33];
lcd.clear(); // gets the lcd ready to be printed to
for (i = 0; i < x.length(); i = i + 1){
a[i] = x.charAt(i);
if(i < 16){
lcd.setCursor(i, 0);
lcd.print(a[i]);
}
else{
lcd.setCursor(i - 16, 1);
lcd.print(a[i]);
}
}
}
// Function to print a question folowing a answer aaq("question to be asked", level, yes or no, "question that proceeds")
void aaq(String x, int y, int z, String a){
if (digitalRead(6)==HIGH && level == y && z == 1 && lastQuestion == a){
lastQuestion = x;
lcd.clear();
printText(x);
level = ++level;
delay(1000);
}
if (digitalRead(7)==HIGH && level == y && z == 2 && lastQuestion == a){
lastQuestion = x;
lcd.clear();
printText(x);
level = ++level;
delay(1000);
}
}
void setup(){
//declare pins
pinMode(6, INPUT);
pinMode(7, INPUT);
//set up # of columns and rows
lcd.begin(16, 2);
//print that message bro
printText("yo waz gud homie");
//delay sequence
delaySequence();
//print that next message brobro
printText("i'm afro da gr8");
//delay sequence
delaySequence();
//let em know what's up
printText("press 6 for YES and 7 for NO");
//delay sequence
delaySequence();
}
void loop(){
//BEGIN 21 QUESTIONS
if (level == 0){
printText("are you cool?");
level = 1;
lastQuestion = "are you cool?";
}
//level 1
aaq("are you spiffy?", 1, 1, "are you cool?");
aaq("are you drunk?", 1, 2, "are you cool?");
//level 2
aaq("do you suck?", 2, 1, "are you spiffy?");
aaq("do you even lift?", 2, 2, "are you spiffy?");
aaq("are you high?", 2, 1, "are you drunk?");
aaq("are you over 21?", 2, 2, "are you drunk?");
//level 3
aaq("do u open the door for da ladies?", 3, 1, "do you suck?");
aaq("do your chain hang low?", 3, 2, "do you suck?");
aaq("do u even kno what's going on?", 3, 1, "do you even lift?");
aaq("what the crimp trainee?", 3, 2, "do you even lift?");
aaq("did you shave with a banana?", 3, 1, "are you high?");
aaq("are your pants on the ground?", 3, 2, "are you high?");
aaq("are you a DBA?", 3, 1, "are you over 21?");
aaq("did you make your bed?", 3, 2, "are you over 21?");
//level 4
aaq("Result: you are the homeless type", 4, 1, "do u open the door for da ladies?");
aaq("Result: you are the ghetto type", 4, 2, "do u open the door for da ladies?");
aaq("Result: you are the wasted type", 4, 1, "do your chain hang low?");
aaq("Result: you are the cool guy type", 4, 2, "do your chain hang low?");
aaq("Result: you are the dirtbag type", 4, 1, "do u even kno what's going on?");
aaq("Result: you are the MTI type", 4, 2, "do u even kno what's going on?");
aaq("Result: you are the swag feg type", 4, 1, "what the crimp trainee?");
aaq("Result: you are the nice guy type", 4, 2, "what the crimp trainee?");
aaq("Result: you are the cool type", 4, 1, "did you shave with a banana?");
aaq("Result: you are the hermit type", 4, 2, "did you shave with a banana?");
aaq("Result: you are the yolo type", 4, 1, "are your pants on the ground?");
aaq("Result: you are the that guy type", 4, 1, "are your pants on the ground?");
aaq("Result: you are the clueless type", 4, 1, "are you a DBA?");
aaq("Result: you are the wtf type", 4, 1, "are you a DBA?");
aaq("Result: you are the ninja type", 4, 1, "did you make your bed?");
aaq("Result: you are the jock type", 4, 1, "did you make your bed?");
}