Browse Source

modif and order

master
Slayr 9 months ago
parent
commit
ad1b8d28a2

INPUT_OUTPUT/Seven_[7]/manual-seven/seven_manual_ino/seven_manual.ino → INPUT_OUTPUT/Seven_[7]/manual-seven/seven_manual_ino/seven_manual/seven_manual.ino View File


+ 309
- 237
INPUT_OUTPUT/Seven_[7]/seven_ino/seven_ino.ino View File

@@ -1,105 +1,120 @@
1
-// TV.OUT LIBRARY
2
-#include <TVout.h> 
3
-#include <fontALL.h>
4
-
5
-// for incoming serial data
6
-int incomingByte = 0; 
7
-
8
-// TV.OUT LIBRARY
9
-TVout TV; 
10
-unsigned char x,y;
11
-
12
-int zOff = 150;
13
-int xOff = 0;
14
-int yOff = 0;
15
-int cSize = 50;
16
-int view_plane = 64;
17
-float angle = PI/60;
18
-
19
-
20
-// P1-P7
21
-int toggle_1;
22
-int toggle_2;
23
-int toggle_3;
24
-int toggle_4;
25
-int toggle_5;
26
-int toggle_6;
27
-int toggle_7;
28
-
29
-
30
-//SHUFFLE TEXT
31
-void shuffle(char *array, size_t n)
32
-{
33
-    if (n > 1) 
34
-    {
35
-        size_t i;
36
-        for (i = 0; i < n - 1; i++) 
37
-        {
38
-          size_t j = i + rand() / (RAND_MAX / (n - i) + 1);
39
-          int t = array[j];
40
-          array[j] = array[i];
41
-          array[i] = t;
42
-        }
43
-    }
44
-}
45
-
46
-const char t0[] PROGMEM = "20:00"; // "String 0" etc are strings to store - change to suit.
47
-const char t1[] PROGMEM = "21:00";
48
-const char t2[] PROGMEM = "22:00";
49
-const char t3[] PROGMEM = "sun";
50
-const char t4[] PROGMEM = "is";
51
-const char t5[] PROGMEM = "down";
52
-const char t6[] PROGMEM = "23:00";
53
-const char t7[] PROGMEM = "00:00";
54
-const char t8[] PROGMEM = "PAVEMENT";
55
-// Then set up a table to refer to your strings.
56
-const char *const string_table[] PROGMEM = {t0, t1, t2, t3, t4, t5, t6, t7, t8};
57
-
58
-
59
-const char *const string_table2[] PROGMEM = {t0, t1, t2};
60
-char input[] = "sundown9";
61
-char buffer[255] = "";
62
-
1
+  // TV.OUT LIBRARY
2
+  #include <TVout.h> 
3
+  #include <fontALL.h>
4
+  //
63 5
   
6
+  // for incoming serial data
7
+  int incomingByte = 0; 
8
+  //
9
+  
10
+  // TV.OUT LIBRARY
11
+  TVout TV; 
12
+  unsigned char x,y;
13
+  
14
+  int zOff = 150;
15
+  int xOff = 0;
16
+  int yOff = 0;
17
+  int cSize = 50;
18
+  int view_plane = 64;
19
+  float angle = PI/60;
20
+  //
21
+  
22
+  // P1-P7
23
+  int pot_1;
24
+  int pot_2;
25
+  int pot_3;
26
+  int pot_4;
27
+  int pot_5;
28
+  int pot_6;
29
+  int pot_7;
30
+
31
+  // B1-B7
32
+  const int BUTTON1 = 10; //B1
33
+  const int BUTTON2 = 9; //B2
34
+  const int BUTTON3 = 8; //B3
35
+  const int BUTTON4 = 7; //B4
36
+  const int BUTTON5 = 6; //B5
37
+  const int BUTTON6 = 5; //B6
38
+  const int BUTTON7 = 4; //B7
39
+   
40
+  int val1= 0;
41
+  int val2= 0;
42
+  int val3= 0;
43
+  int val4= 0;
44
+  int val5= 0;
45
+  int val6= 0;
46
+  int val7= 0;
47
+  // 
64 48
 
49
+  
50
+  //SHUFFLE TEXT
51
+  void shuffle(char *array, size_t n)
52
+  {
53
+      if (n > 1) 
54
+      {
55
+          size_t i;
56
+          for (i = 0; i < n - 1; i++) 
57
+          {
58
+            size_t j = i + rand() / (RAND_MAX / (n - i) + 1);
59
+            int t = array[j];
60
+            array[j] = array[i];
61
+            array[i] = t;
62
+          }
63
+      }
64
+  }
65 65
 
66
-//TEXT
67
-const char *animals[] = {"repetative", " ", "on", "cockroach"}; //A0
68
-
69
-const char *BOBZ[] = {"labour", "silhouette", "bark", "or", "alligators ", "pitbulls", "depending"}; //A1
70
-
71
-const char *part3[] = {"like", "wind", "not", "overdo"}; //A2
72
-
73
-const char *part4[] = {
74
-  "dont be scared",
75
-  " dont avoid",
76
-  "you are soft",
77
-  " HANDS"
78
-};
79
-
80
-const byte letter = 25;
81
- char *letters[letter] = {"RUFF","A","B","C","D","RUDE","E","F","G","K","L","repetitive labour","M","N","O","P","R","S","T","U","V","W","Y","Z"}; 
66
+ //AM
67
+  const char t0[] PROGMEM = "20:00"; // "String 0" etc are strings to store - change to suit.
68
+  const char t1[] PROGMEM = "21:00";
69
+  const char t2[] PROGMEM = "22:00";
70
+  const char t3[] PROGMEM = "01:00 ";
71
+  const char t4[] PROGMEM = "02:00";
72
+  const char t5[] PROGMEM = "03:00";
73
+  const char t6[] PROGMEM = "23:00";
74
+  const char t7[] PROGMEM = "00:00";
75
+  const char t8[] PROGMEM = "PAVEMENT";
76
+  // Then set up a table to refer to your strings.
77
+  const char *const string_table[] PROGMEM = {t0, t1, t2, t3, t4, t5, t6, t7, t8};
78
+  const char *const string_table2[] PROGMEM = {t0, t1, t2};
79
+  
80
+  char input[] = "SUNDOWN9";
81
+  char buffer[255] = "";
82
+  //
83
+    
84
+  
85
+  
86
+  //TEXT
82 87
 
83
-const char *words[] ={"street", "at night they", "by day"};
88
+  //I
89
+  const char *part1[] = {"repetative", "bench ", "on", "cockroach", "", "   [you are soft]   ",}; //P1 [0-5]
84 90
 
91
+  //II
92
+  const char *part2[] = {"labour", "silhouette ", "bark ", " wind", "alligators ", "pitbulls", "", "depending, ", " dont avoid",}; //P2 [0-8]
85 93
 
86
-const int BUTTON1 = 4; //B1
87
-const int BUTTON2 = 5; //B2
88
-const int BUTTON3 = 6; //B3
89
-const int BUTTON4 = 7; //B4
90
-const int BUTTON5 = 8; //B5
91
-const int BUTTON6 = 9; //B6
92
-const int BUTTON7 = 10; //B7
94
+  //III
95
+  const char *part3[] = {"at night they", "like", "", "or", "dont be scared", "not ", "overdo", "street", " HANDS", "by day"}; //P3 [0-9]
93 96
 
94 97
 
98
+    
99
+    
100
+  
95 101
 
96
-int val1= 0;
97
-int val2= 0;
98
-int val3= 0;
99
-int val4= 0;
100
-int val5= 0;
101
-int val6= 0;
102
-int val7= 0;
102
+  //ALPHA
103
+  const byte letter = 25;
104
+   char *letters[letter] = {"RUFF","A","B","C","D","RUDE","E","F","G","K","L","repetitive labour","M","N","O","P","R","S","T","U","V","W","Y","Z"}; 
105
+  
106
+  const char msg1[] PROGMEM = {"  you did see me"};
107
+  const char msg2[] PROGMEM = {"  it fell out"};
108
+  const char msg3[] PROGMEM = {"  like you hear me"};
109
+  
110
+  unsigned int displayInt;
111
+  char charmsg1;
112
+  char charmsg2;
113
+  char charmsg3;
114
+  
115
+  
116
+  
117
+  
103 118
 
104 119
 
105 120
 
@@ -124,192 +139,249 @@ void setup() {
124 139
 
125 140
 void loop() {
126 141
   
127
-
128
-toggle_1 = analogRead(A6); //P1
129
-toggle_2 = analogRead(A5); //P2
130
-toggle_3 = analogRead(A4); //P3
131
-toggle_4 = analogRead(A3); //P4
132
-toggle_5 = analogRead(A2); //P5
133
-toggle_6 = analogRead(A1); //P6
134
-toggle_7 = analogRead(A0); //P7
135
-
136
-
137
-val1 = digitalRead(BUTTON1);
138
-val2 = digitalRead(BUTTON2);
139
-val3 = digitalRead(BUTTON3);
140
-val4 = digitalRead(BUTTON4);
141
-val5 = digitalRead(BUTTON5);
142
-val6 = digitalRead(BUTTON6);
143
-val7 = digitalRead(BUTTON7);
144
-
145
-//int l = strlen(string_table);
146
-//shuffle(input, l );
147
-  //TV.println(input);
148
-  //delay(200);
149
-
150
-
151
-
142
+  
143
+  pot_1 = analogRead(A0); //P1
144
+  pot_2 = analogRead(A1); //P2
145
+  pot_3 = analogRead(A2); //P3
146
+  pot_4 = analogRead(A3); //P4
147
+  pot_5 = analogRead(A4); //P5
148
+  pot_6 = analogRead(A5); //P6
149
+  pot_7 = analogRead(A6); //P7
150
+  
151
+  
152
+  val1 = digitalRead(BUTTON1);
153
+  val2 = digitalRead(BUTTON2);
154
+  val3 = digitalRead(BUTTON3);
155
+  val4 = digitalRead(BUTTON4);
156
+  val5 = digitalRead(BUTTON5);
157
+  val6 = digitalRead(BUTTON6);
158
+  val7 = digitalRead(BUTTON7);
159
+  
160
+ 
152 161
 //B1
153
-  if (val1 == HIGH) {
154
-  TV.select_font(font4x6);
155
-  TV.print("POETRY");
156
-  Serial.print("POETRY"); //SEND TX
157
-  TV.draw_line(60,20,60,76,WHITE);
158
-  } //done
162
+    if (val1 == HIGH) {
163
+    TV.select_font(font4x6);
164
+    TV.print("POETRY");
165
+    Serial.print("POETRY"); //SEND TX
166
+    TV.draw_line(60,20,60,76,WHITE);
167
+    } //done
159 168
 
160 169
 //B2
161
-  if (val2 == HIGH) {
162
-  TV.select_font(font6x8);
163
-  TV.print("corner");
164
-  TV.draw_line(20,20,60,76,WHITE);
165
-
166
-  if(toggle_4 < 500){
167
-  TV.print("worst-case scenario",10,10);
168
-  Serial.print("worst-case scenario"); //SEND TX
169
-  }
170
-  }
171
-
170
+// \CORNER
171
+    if (val2 == HIGH) {
172
+    if (pot_4 <500){
173
+    TV.select_font(font6x8);
174
+    TV.print("corner");
175
+    TV.draw_line(20,20,60,76,WHITE);}
176
+  
177
+    if(pot_4 > 500){
178
+    TV.select_font(font8x8);
179
+    TV.print(10,10,"worst-case scenario");
180
+    Serial.print("worst-case scenario"); //SEND TX
181
+    }
182
+    }
183
+    
172 184
 //B3 
173
-//crash
174
-  if (val3 == HIGH) {
175
-  for (int i=0; i<TV.hres(); i++) {
176
-  TV.print(i,44,F("cigarette"));
177
-  TV.select_font(font8x8ext);
178
-  TV.print(i,i,F("TTTTTTTTTTTTTT"));
179
-  TV.delay(200);
180
-  Serial.print("cigarette"); ////SEND TX
181
-}
185
+//crash CIG
186
+    if (val3 == HIGH) {
187
+    for (int i=0; i<TV.hres(); i++) {
188
+    TV.print(i,44,F("cigarette"));
189
+    TV.select_font(font8x8ext);
190
+    TV.print(i,i,F("TTTTTTTTTTTTTT"));
191
+    TV.delay(200);
192
+    Serial.print("cigarette"); ////SEND TX
182 193
   }
194
+    }
183 195
   
184 196
 //B4
185 197
 //blinking
186
-  if (val4 == HIGH) {
187
-  TV.print(letters[random(0,letter)]);
188
-  TV.select_font(font4x6);
189
-  TV.print(10,10,F("good evening"));
190
-  TV.draw_rect(20,20,33,76,0,0);
191
-  TV.draw_line(20,20,33,76,1);
192
-  TV.clear_screen();
193
-}
198
+    if (val4 == HIGH) {
199
+    if(pot_2 < 100) {
200
+      TV.clear_screen();
201
+      TV.print("dry eyes red eyes itchy eyes");
202
+    }
203
+
204
+    else if(pot_2 > 1000) {
205
+      TV.print(10,10,F(" >>>>>>>>>>>>>>>>okokokok>>>>>>>>>>>>>>>>>>>>dont be scared "));
206
+      TV.delay(50);
207
+    }
208
+
209
+    else {
210
+      TV.print(letters[random(0,letter)]);
211
+      TV.select_font(font4x6);
212
+      TV.print(10,10,F("good evening"));
213
+      TV.draw_rect(20,20,33,76,0,0);
214
+      TV.draw_line(20,20,33,76,1);
215
+      TV.clear_screen();
216
+    }
217
+    }
194 218
 
195 219
 //B5
196
-//RECEIVES TX
197
-if (val5 == HIGH) {
198
-TV.print((char)Serial.read()); 
199
-TV.delay(20);
200
-} 
220
+//TX IN
221
+    if (val5 == HIGH) {
222
+    TV.print((char)Serial.read()); 
223
+    TV.delay(50);
224
+    } 
201 225
 
202 226
 //B6
203 227
 //alpha
204
-if (val6 == HIGH) {
205
-TV.print(letters[random(0,letter)]);
206
-}
228
+    if (val6 == HIGH) {
229
+    if(pot_1 < 400){
230
+      TV.select_font(font6x8);
231
+      TV.print ("girls wish to risk");
232
+      Serial.print ("girls wish to risk");
233
+    }
234
+
235
+    if(pot_1 > 400){
236
+    TV.print(letters[random(0,letter)]);
237
+    }
238
+    }
207 239
 
240
+    
208 241
 //B6
209 242
 //TEXT OUT
210
-if (val7 == HIGH) {
211
-
212
-//SHUFFLE sentance
213
-  //int l = strlen(input);
214
-  //shuffle(input, l );
215
-  //TV.println(input);
216
-  //delay(100);
217
-  //Serial.print("SUN IS DOWN"); //TXT OUT
243
+  if (val7 == HIGH) {
218 244
 
219 245
 //SHUFFLE list/ times
220
-  for (int i = 0; i < 9; i++) {
221
-  strcpy_P(buffer, (char *)pgm_read_word(&(string_table[i]))); 
222
-  shuffle(buffer, strlen(buffer));
223
-  TV.print(buffer);
224
-  delay(100);
246
+    for (int i = 0; i < 9; i++) {
247
+    strcpy_P(buffer, (char *)pgm_read_word(&(string_table[i]))); 
248
+    shuffle(buffer, strlen(buffer));
249
+    TV.print(buffer);
250
+    delay(100);
251
+    }
225 252
   }
226
-}
227 253
 
228 254
 
229
-
230
- if(toggle_5 >500){
255
+//P5 [main]
256
+    if(pot_5 >500){
231 257
 
232 258
 //P1   
233
-//map   
234
-  int animal; //animals
235
-  animal = map(toggle_1, 10, 1023, 0, 3);
236
-  TV.print(animals[animal]);
237
-  delay(50);
238
-
239
-if (toggle_1<10){
240
-  TV.select_font(font4x6);
241
-  TV.print("  ");
242
-  delay(500); 
243
-}
244
-
259
+  //space&slower
260
+    if (pot_1<10){
261
+    TV.select_font(font4x6);
262
+    TV.print("  ");
263
+    delay(500); 
264
+    }
265
+ //map I
266
+    int p1; //animals
267
+    p1 = map(pot_1, 10, 1023, 0, 5);
268
+    TV.select_font(font4x6);
269
+    TV.print(part1[p1]);
270
+    delay(50);
271
+  
245 272
   
246
-
247 273
 //P2
248
-//string list
249
-  int BOB; //BOBZ
250
-  BOB = map(toggle_2, 0, 1023, 0, 6);
251
-  TV.print(BOBZ[BOB]);
252
-  TV.delay(50);
274
+//map II
275
+    int p2; //BOBZ
276
+    p2 = map(pot_2, 0, 1023, 0, 8);
277
+    TV.select_font(font4x6);
278
+    TV.print(part2[p2]);
279
+    TV.delay(50);
253 280
   
254 281
 //P3
255
-//map  
256
-  int w1; //words
257
-  w1 = map(toggle_3, 0, 1023, 0, 3);
258
-  TV.print(words[w1]);
259
-  TV.delay(50);
282
+//map III 
283
+    int p3; //words
284
+    p3 = map(pot_3, 0, 1023, 0, 9);
285
+    TV.select_font(font4x6);
286
+    TV.print(part3[p3]);
287
+    TV.delay(50);
288
+
289
+
290
+//P4
291
+    if (pot_4>100 & pot_4<500){
292
+      TV.print("");
293
+    }
294
+    
295
+    if (pot_4>100 & pot_4<500){
296
+      TV.print("SUN IS DOWN");
297
+      delay(50); 
298
+      }
299
+      
300
+    if (pot_4>500 & pot_4<1023){
301
+      //SHUFFLE sentance
302
+      int l = strlen(input);
303
+      shuffle(input, l );
304
+      TV.print(input);
305
+      delay(20);
306
+      Serial.print("SUN IS DOWN"); //TXT OUT 
307
+      }
308
+
309
+
260 310
 
261 311
 //P6
262 312
 //draw and text
263 313
   
264 314
 
265
-  if(toggle_6>0 & toggle_6<100 ){
315
+  if(pot_6>0 & pot_6<100 ){
266 316
     TV.invert();
267
-  TV.print(10,10,F("stretched torso abs rocks "));
268
-  }
269
-  else if(toggle_6>100 & toggle_6<200){
270
-  TV.print(30,50,F("where are you going"));
271
-  delay(50);
272
-  }
273
-  else if(toggle_6>200 & toggle_6<300){
274
-  TV.select_font(font8x8ext);
275
-  TV.print(50,50,F("to step into a dark place"));
276
-  }
277
-  else if(toggle_6>350 & toggle_6<500){
278
-  TV.print(10,70,"need someone to play with");
279
-  }
280
-  else if(toggle_6>500 & toggle_6<1023){
317
+    TV.print(10,10,F("stretched torso abs rocks "));
318
+    }
319
+    else if(pot_6>100 & pot_6<200){
320
+    TV.print(30,50,F("where are you going"));
321
+    delay(50);
322
+    }
323
+    else if(pot_6>200 & pot_6<300){
324
+    TV.select_font(font8x8ext);
325
+    TV.print(50,50,F("TO STEP INTO A DARK PLACE"));
326
+    }
327
+    else if(pot_6>300 & pot_6<400){
328
+    TV.print("");
329
+    }
330
+     else if(pot_6>300 & pot_6<400){
331
+    TV.print("time to speak");
332
+    }
333
+    else if(pot_6>500 & pot_6<900){
334
+    TV.print(10,70," need someone to play with");
335
+    }
336
+    else if(pot_6>900 & pot_6<1023){
337
+    TV.print("scratch");
338
+    }
281 339
     
282
-  TV.print("scratch");
283
-  }
284 340
 
285 341
  
286 342
 
287 343
 //P7
288
-//
289
-  //int p4;
290
-  //p4 = map(toggle_7, 0, 250, 0, 3);
291
-  //TV.print(part4[p4]);
292
-  //delay(100);
293
-
294
-  if (toggle_7>0 & toggle_7<500){
295
-    for (int i = 0; i < 3; i++) {
296
-  strcpy_P(buffer, (char *)pgm_read_word(&(string_table2[i]))); 
297
-  shuffle(buffer, strlen(buffer));
298
-  TV.print(buffer);
299
-  delay(300);  
300
-  }
301
-  }
344
+  if (pot_7<100){
345
+    TV.clear_screen();
346
+    TV.select_font(font6x8);
347
+    for (byte k = 0; k < strlen(msg1); k++) {
348
+    charmsg1 = pgm_read_byte_near(msg1 + k);
349
+    TV.print(charmsg1);
350
+    delay(500);}
351
+    }
352
+
353
+    else if (pot_7>100 & pot_7<300){
354
+    TV.clear_screen();
355
+    TV.select_font(font6x8);
356
+    for (byte k = 0; k < strlen(msg2); k++) {
357
+    charmsg2 = pgm_read_byte_near(msg2 + k);
358
+    TV.print(charmsg2);
359
+    delay(300);}
360
+    }
361
+
362
+    else if (pot_7>300 & pot_7<500){
363
+    TV.clear_screen();
364
+    TV.select_font(font6x8);
365
+    for (byte k = 0; k < strlen(msg3); k++) {
366
+    charmsg3 = pgm_read_byte_near(msg3 + k);
367
+    TV.print(charmsg3);
368
+    delay(50);}
369
+    }
302 370
   
303
-  else if (toggle_7>500 & toggle_7<800){
371
+    else if (pot_7>500 & pot_7<800){
304 372
     TV.select_font(font8x8ext);
305 373
     TV.print(30,10,F("lean on a car"));
306
-  }
307
-    else if (toggle_7>800 & toggle_7<1023){
308
-    //TV.select_font(font8x8ext);
374
+    }
375
+    
376
+    else if (pot_7>800 & pot_7<999){
377
+    TV.select_font(font4x6);
309 378
     TV.print("lean on a car");
310
-  }
311
-  
379
+   }
312 380
   
381
+   else if (pot_7<999){
382
+    TV.select_font(font4x6);
383
+    TV.print("");
384
+   }
313 385
   
314 386
 
315 387
 
@@ -320,7 +392,7 @@ if (toggle_1<10){
320 392
 
321 393
 //P5 
322 394
 //7777777...
323
-   else if(toggle_5 <100){
395
+   else if(pot_5 <100){
324 396
    TV.print("7");  
325 397
    }
326 398
 

Loading…
Cancel
Save