Browse Source

lil text shuffle tryout

master
Slayr 1 year ago
parent
commit
82c4d9fc53
1 changed files with 45 additions and 0 deletions
  1. 45
    0
      sketches/my_sk_sandra/catdogmouse/catdogmouse.ino

+ 45
- 0
sketches/my_sk_sandra/catdogmouse/catdogmouse.ino View File

@@ -0,0 +1,45 @@
1
+/*
2
+*/
3
+int toggle_2;
4
+int toggle_1;
5
+const byte NUMBER_OF_NAMES = 5;
6
+char *names[NUMBER_OF_NAMES] = {
7
+ "BOB0",
8
+ "BOB1",
9
+ "BOB2",
10
+ "BOB3",
11
+ "BOB4",};
12
+void setup() {
13
+  // initialize serial communications (for debugging only):
14
+  Serial.begin(9600);
15
+  
16
+}
17
+
18
+
19
+void loop() {
20
+  toggle_2 = analogRead(2);
21
+  if (toggle_2 < 250) {
22
+  Serial.println(" cat");
23
+  }
24
+
25
+else if(toggle_2 >250 && toggle_2 <500){
26
+  Serial.println(" dog");
27
+  }
28
+
29
+else if(toggle_2 >500 && toggle_2 <750){
30
+  Serial.println(" mouse");
31
+  }
32
+
33
+else if(toggle_2 >750){
34
+  Serial.println(" cockroach");
35
+  }
36
+delay(250);
37
+ 
38
+{
39
+  randomSeed(analogRead(0));
40
+  Serial.print("Hello ");
41
+  Serial.print(names[random(0,NUMBER_OF_NAMES)]); 
42
+} 
43
+
44
+       // delay in between reads for stability
45
+}

Loading…
Cancel
Save