more txt / serial monitor only

master
Slayr 5 years ago
parent 82c4d9fc53
commit 90939591a6

@ -1,14 +1,33 @@
/* /*
*/ */
int toggle_3;
int toggle_2; int toggle_2;
int toggle_1; int toggle_1;
const byte NUMBER_OF_NAMES = 5;
char poetry;
char animal1[] = " cat";
char animal2[] = " dog";
char animal3[] = " mouse";
char animal4[]= " cockroach";
char str[] = "hello";
char str2[] = "CAT";
char str3[] = "BARK";
String str4 = "booomaaar";
const byte NUMBER_OF_NAMES = 7;
char *names[NUMBER_OF_NAMES] = { char *names[NUMBER_OF_NAMES] = {
"BOB0", "BOB0",
"BOB1", "BOB1",
"BOB2", "BOB2",
"BOB3", "BOB3 ",
"BOB4",}; "BOB4",};
const byte greet = 4;
char *greets[greet] = {
"Hello",
"Hi",
"hey",
"ayyy",};
void setup() { void setup() {
// initialize serial communications (for debugging only): // initialize serial communications (for debugging only):
Serial.begin(9600); Serial.begin(9600);
@ -17,29 +36,78 @@ void setup() {
void loop() { void loop() {
toggle_2 = analogRead(2); toggle_2 = analogRead(2);
if (toggle_2 < 250) { if (toggle_2 < 250) {
Serial.println(" cat"); Serial.print (str4);
Serial.println(animal1);
} }
else if(toggle_2 >250 && toggle_2 <500){ else if(toggle_2 >250 && toggle_2 <350){
Serial.println(" dog");
Serial.print(animal2);
}
else if(toggle_2 >350 && toggle_2 <500){
str4.replace ("b", "B");
Serial.print (str4);
Serial.println(animal2);
} }
else if(toggle_2 >500 && toggle_2 <750){ else if(toggle_2 >500 && toggle_2 <750){
Serial.println(" mouse"); str4.replace ("o", "0");
Serial.print (str4);
delay(500);
str4.replace ("a", "44");
Serial.print (str4);
Serial.println(animal3);
} }
else if(toggle_2 >750){ else if(toggle_2 >750){
Serial.println(" cockroach"); Serial.println(animal4);
} }
delay(250); delay(250);
toggle_1 = analogRead(1);
if (toggle_1 < 250) {
Serial.println(&str[4]); //prints "o"
Serial.println(&str[3]);// prints "lo"
}
else if(toggle_1 >250 && toggle_1 <500){
Serial.print(&str[3]); //prints "lo"
Serial.print(&str2[1]); // prints "AT"
Serial.print(&str3[3]); //prints "K"
Serial.print(&str3[0]); // prints "AT"
}
else if(toggle_1 >500 && toggle_1 <750){
Serial.println(&str[0]); // prints "hello"
}
else if(toggle_1 >750){
Serial.print(&str[2]); // prints "llo"
Serial.print(&str2[0]); // prints "CAT"
}
{ {
randomSeed(analogRead(0)); randomSeed(analogRead(0));
Serial.print("Hello "); Serial.print("Hello ");
Serial.print(greets[random(0,greet)]);
Serial.print(names[random(0,NUMBER_OF_NAMES)]); Serial.print(names[random(0,NUMBER_OF_NAMES)]);
} }
// delay in between reads for stability toggle_3 = analogRead(3);
if (toggle_3 > 250) {
Serial.println(" POETRY");
}
} }

Loading…
Cancel
Save