/
Random-TENS.ino
1264 lines (961 loc) · 30.9 KB
/
Random-TENS.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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Created by Veronika Nowaková 2020
under CC license
Attribution (CC BY-NC-SA 4.0)
" https://creativecommons.org/licenses/by-nc-sa/4.0/ "
VERSION 0.9.5
language EN
*/
#include <Arduino.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
// -------------------------------------------------- //
// ------------------- SETTINGS --------------------- //
// -------------------------------------------------- //
// SETTING THE INTENSITY OF MAX VALUE
int inte_1 = 5;
int inte_2 = 5;
int inte_3 = 4;
int inte_4 = 4;
int inte_5 = 3;
// CALIBRATE FLOW METER ML/SEC FOR PUMP MIN MAX VALUES
long min_mn = 1000; // m sec
long max_mn = 5000; // m sec
// SETTING THE MAXIMUM NUMBER FOR THE PUMP
int max_pocet_cerpani = 10;
// set min max time range
float time_min_minuts = 30; // sec
float time_max_minuts = 1; // min
// SETTING RANDOM RANGE OF TRUE ANSWER BEFORE RELEASE
int number_of_answer_min = 1;
int number_of_answer_max = 4;
// pin connection settings ( change only if you change connections )
const int pin_on_off = 2; // switch on off
const int pin_mode = 3; // switch mode
const int pin_intensity = 4; // switch intensity +
const int pin_safety_switch = 5; // safety switch off if pc or power conect off.
const int pin_lock = 8; // release lock
const int pin_prog_6 = 9; // relay for external device
const int pin_alternative = 10; // alternative options for program 6 ( in develop )
const int pin_correct_switch = 11;// switch triger correct response
const int pin_start_switch = 12; // switch to triger random tens
// TEXT FOR LCD AND SERIA OUT ( you can easily translate output)
String text_test = "test of line";
String text_correct_answer_1 = "Correct answer ";
String text_TOTAL_1 = "TOTAL ";
String text_correct_answer_2 = "Correct answer";
String text_Answers_needed = "Answers needed";
String text_max_Time = "max Time";
String text_answers = "answers";
String text_you_will_be_free = "text you will be free";
String text_Added_correct_answers_1 = "Added correct answers ";
String text_Added_correct_answers_2 = " Added correct answers";
String text_total_correct_answers_1 = "total correct answers needed ";
String text_intensity_1 = "Intensity";
String text_intensity_2 = " Intensity ";
String text_Length = "Length ";
String text_minute_1 = " min";
String text_minute_2 = " minute ";
String text_seconds_1 = " sec ";
String text_seconds_2 = " seconds ";
String text_st_1 = "One more intensity";
String text_st_2 = "Two more intensity";
String text_more_time = "More time ";
String text_nothing = "nothing added";
String text_CONTINUE = "CONTINUE";
String text_time = "the rest of the time";
String text_end_lesson_1 = " END OF LESSON ";
String text_end_lesson_2 = "END OF LESSON";
String text_mistake = "don't make a mistake";
String text_Second_event = "Second eventuality";
String text_volume_1 = "volume";
String text_volume_2 = " volume ";
String text_Program_1_1 = "Program 1";
String text_Program_1_2 = "Program 1 ";
String text_program_2_1 = "Program 2";
String text_program_2_2 = "Program 2 ";
String text_program_3_1 = "Program 3";
String text_program_3_2 = "Program 3 ";
String text_program_4_1 = "Program 4";
String text_program_4_2 = "Program 4 ";
String text_program_5_1 = "Program 5";
String text_program_5_2 = "Program 5 ";
String text_program_6 = "Program 6";
// -------------------------------------------------- //
// ----------- VARIABLES DO NOT CHANGE -------------- //
// -------------------------------------------------- //
int extra;
int start_switch;
int true_switch;
int program;
int number_of_true_answer = 0;
int number_of_true_for_release;
int extra_for_release;
int extra_answer;
int intensity;
int number_of_pump;
int total_stop;
int stop_repetition = 0;
int banned = 0;
int V_text_nothing = 0;
float volume;
float time = 0.0;
float time_min = (time_min_minuts * 1000); // ms
float time_max = (time_max_minuts * 1000 * 60);
float extra_time = 0.0;
char input;
char start;
char true_answer;
char test;
LiquidCrystal_I2C lcd (0x27, 20, 4);
void setup ()
{
lcd.init ();
lcd.backlight ();
lcd.setCursor (0, 0);
randomSeed (analogRead (0));
Serial.begin (9600);
pinMode (pin_start_switch, INPUT_PULLUP);
pinMode (pin_on_off, OUTPUT);
pinMode (pin_mode, OUTPUT);
pinMode (pin_intensity, OUTPUT);
pinMode (pin_prog_6, OUTPUT);
pinMode (pin_safety_switch, OUTPUT);
pinMode (pin_lock, OUTPUT);
pinMode (pin_correct_switch, INPUT_PULLUP);
digitalWrite (pin_lock, HIGH);
number_of_true_for_release = random (number_of_answer_min, number_of_answer_max);
lcd.clear ();
lcd.setCursor (1, 0);
lcd.print (text_max_Time);
lcd.setCursor (11, 0);
lcd.print (time_max_minuts);
lcd.setCursor (1, 1);
lcd.print (text_answers);
lcd.setCursor (11, 1);
lcd.print (number_of_true_for_release);
delay (10000);
}
void loop ()
{
start:
if (banned == 0)
{
while (Serial.available ()) // externí příkaz
{
input = Serial.read ();
if (input == 'a')
{
true_answer = input;
}
else if (input == 'b')
{
start = input;
}
else if (input == 't')
{
test = input;
}
}
}
if (test == 't')
{
test = ' ';
Serial.print (text_test);
Serial.print (test);
lcd.clear();
lcd.setCursor (4, 1);
lcd.print (text_test);
lcd.setCursor (12, 1);
lcd.print (test);
delay (5000);
lcd.clear();
}
if (banned == 0)
{
true_switch = digitalRead (pin_correct_switch);
}
if ((true_answer == 'a') || (true_switch == LOW)) // spusteni spravne odpovedi
{
banned = 1;
number_of_true_answer = (number_of_true_answer + 1);
true_answer = ' ';
Serial.println (text_correct_answer_1);
Serial.print (text_TOTAL_1);
Serial.println (number_of_true_answer);
lcd.setCursor (3, 1);
lcd.print (text_correct_answer_2);
lcd.setCursor (6, 2);
lcd.print (text_TOTAL_1);
lcd.setCursor (14, 2);
lcd.print (number_of_true_answer);
lcd.setCursor (5, 3);
lcd.print (text_Answers_needed);
lcd.setCursor (14, 3);
lcd.print (number_of_true_for_release);
delay (3000);
lcd.setCursor (0, 2);
lcd.print (" ");
lcd.setCursor (0, 3);
lcd.print (" ");
banned = 0;
}
if (number_of_true_answer == number_of_true_for_release) // HLAVNI UVOLNENI
{
extra_for_release = random (1, 10);
switch (extra_for_release)
{
case 1:
case 10:
case 9:
case 4:
case 5:
ukonceni:
digitalWrite (pin_lock, LOW);
lcd.clear ();
lcd.setCursor (3, 2);
lcd.print (text_you_will_be_free);
for (;;)
{
Serial.println (text_you_will_be_free);
delay (1000);
}
delay (500);
break;
case 6:
case 7:
case 8:
case 3:
case 2:
if (stop_repetition == 1)
{
goto ukonceni;
}
else
{
extra_answer = random (1, 10);
number_of_true_for_release = (number_of_true_for_release + extra_answer);
stop_repetition = 1; // Disable Repeat
Serial.print (text_Added_correct_answers_1);
Serial.print (extra_answer);
Serial.println ('\n');
Serial.print (text_total_correct_answers_1);
Serial.print (number_of_true_for_release);
lcd.clear ();
lcd.setCursor (2, 1);
lcd.print (extra_answer);
lcd.print (text_Added_correct_answers_2);
delay (5000);
goto start;
}
}
}
if (banned == 0)
{
start_switch = digitalRead (pin_start_switch);
}
if (total_stop == 0)
{
delay (300000);
if ( (start_switch == HIGH) || (start == 'b'))
{
start = ' ';
banned = 1;
program = random (1, 12);
switch (program)
{
case 12:
case 1: // program 1 TR. ( 2 )
lcd.clear ();
lcd.setCursor (1, 0);
lcd.print (text_Program_1_1);
Serial.println ('\n');
Serial.print (text_Program_1_2);
digitalWrite (pin_on_off, HIGH); // ON
delay (250);
digitalWrite (pin_on_off, LOW);
delay (250);
digitalWrite (pin_mode, HIGH); // mode
delay (250);
digitalWrite (pin_mode, LOW);
delay (250);
intensity = random (1, inte_1); // intensity
lcd.setCursor (1, 1);
lcd.print (text_intensity_1);
lcd.setCursor (11, 1);
lcd.print (intensity);
Serial.print (" ");
Serial.print (text_intensity_2);
Serial.print (intensity);
Serial.print (" ");
digitalWrite (pin_safety_switch, HIGH);
lcd.setCursor (16, 0);
lcd.print (" ");
time = random (time_min, time_max); // delka
lcd.setCursor (1, 2);
lcd.print (text_Length);
lcd.setCursor (7, 2);
lcd.print (time / 1000 / 60);
lcd.setCursor (12, 2);
lcd.print (text_minute_1);
Serial.print (text_Length);
Serial.print (time / 1000);
Serial.print (text_seconds_2);
Serial.print (time / 1000 / 60);
Serial.print (text_minute_2);
Serial.println ('\n');
delay (5000);
for (int i = 0; i < intensity; i++)
{
digitalWrite (pin_intensity, HIGH);
delay (250);
digitalWrite (pin_intensity, LOW);
delay (1000);
}
delay (time / 4 * 3);
extra = random (100, 116); // volba pridavku
Serial.println (extra);
switch (extra)
{
case 100:
lcd.setCursor (1, 3);
lcd.print (text_st_1);
Serial.println ('\n');
Serial.print (text_st_1);
Serial.println ('\n');
digitalWrite (pin_intensity, HIGH);
delay (250);
digitalWrite (pin_intensity, LOW);
delay (250);
goto pokracovat_1;
case 111:
lcd.setCursor (1, 3);
lcd.print (text_st_2);
Serial.println ('\n');
Serial.print (text_st_2);
Serial.println ('\n');
for (int i = 0; i < 3; i++)
{
digitalWrite (pin_intensity, HIGH);
delay (250);
digitalWrite (pin_intensity, LOW);
delay (1000);
}
goto pokracovat_1;
case 112:
extra_time = random ((time / 10), (time /2));
lcd.setCursor (1, 3);
lcd.print (text_more_time);
lcd.setCursor (7, 3);
lcd.print (extra_time / 1000);
lcd.setCursor (11, 3);
lcd.print ("s ");
Serial.println ('\n');
Serial.print (text_more_time);
Serial.print (extra_time / 1000);
Serial.print (text_seconds_1);
Serial.print (extra_time / 1000 / 60);
Serial.print (text_minute_2);
delay (extra_time);
goto pokracovat_1;
default:
V_text_nothing = true;
lcd.setCursor (0, 3);
lcd.print (text_nothing);
Serial.println ('\n');
Serial.print (text_nothing);
Serial.println ('\n');
goto pokracovat_1;
}
pokracovat_1:
if (V_text_nothing == true)
{
lcd.setCursor (10, 3);
lcd.print (text_CONTINUE);
}
Serial.println ('\n');
Serial.print (text_time);
delay (time / 4);
Serial.println ('\n');
Serial.print (text_end_lesson_1);
Serial.println ('\n');
digitalWrite (pin_on_off, HIGH); // vypnuto
delay (250);
digitalWrite (pin_on_off, LOW);
delay (250);
digitalWrite (pin_safety_switch, LOW);
Serial.println ('\n');
lcd.clear ();
lcd.setCursor (4, 1);
lcd.print (text_end_lesson_2);
delay (3000);
banned = 0;
break;
case 11:
case 2: // program 2 ST. ( 4 )
lcd.clear ();
lcd.setCursor (1, 0);
lcd.print (text_program_2_1);
Serial.println ('\n');
Serial.print (text_program_2_2);
digitalWrite (pin_on_off, HIGH); // zapnuto
delay (250);
digitalWrite (pin_on_off, LOW);
delay (250);
for (int i = 0; i < 3; i++) // 3x mode
{
digitalWrite (pin_mode, HIGH);
delay (250);
digitalWrite (pin_mode, LOW);
delay (250);
}
intensity = random (1, inte_2); // intenzita
lcd.setCursor (1, 1);
lcd.print (text_intensity_1);
lcd.setCursor (11, 1);
lcd.print (intensity);
Serial.print (" ");
Serial.print (text_intensity_2);
Serial.print (intensity);
Serial.print (" ");
digitalWrite (pin_safety_switch, HIGH);
lcd.setCursor (16, 0);
lcd.print (" ");
time = random (time_min, time_max); // delka
lcd.setCursor (1, 2);
lcd.print (text_Length);
lcd.setCursor (7, 2);
lcd.print (time / 1000 / 60);
lcd.setCursor (12, 2);
lcd.print (text_minute_1);
Serial.print (text_Length);
Serial.print (time / 1000);
Serial.print (text_seconds_2);
Serial.print (time / 1000 / 60);
Serial.print (text_minute_2);
Serial.println ('\n');
delay (5000);
for (int i = 0; i < intensity; i++)
{
digitalWrite (pin_intensity, HIGH);
delay (250);
digitalWrite (pin_intensity, LOW);
delay (1000);
}
delay (time / 4 * 3);
extra = random (20, 26); // volba pridavku
switch (extra)
{
case 20:
lcd.setCursor (1, 3);
lcd.print (text_st_1);
Serial.println ('\n');
Serial.print (text_st_1);
Serial.println ('\n');
digitalWrite (pin_intensity, HIGH);
delay (250);
digitalWrite (pin_intensity, LOW);
delay (250);
delay (3000);
goto pokracovat_2;
case 21:
lcd.setCursor (1, 3);
lcd.print (text_st_2);
Serial.println ('\n');
Serial.print (text_st_2);
Serial.println ('\n');
for (int i = 0; i < 3; i++)
{
digitalWrite (pin_intensity, HIGH);
delay (250);
digitalWrite (pin_intensity, LOW);
delay (1000);
}
delay (3000);
goto pokracovat_2;
case 22:
extra_time = random ((time / 10), (time /2));
lcd.setCursor (1, 3);
lcd.print (text_more_time);
lcd.setCursor (7, 3);
lcd.print (extra_time / 1000);
lcd.setCursor (11, 3);
lcd.print ("s ");
Serial.println ('\n');
Serial.print (text_more_time);
Serial.print (extra_time / 1000);
Serial.print (text_seconds_1);
Serial.print (extra_time / 1000 / 60);
Serial.print (text_minute_2);
delay (extra_time);
goto pokracovat_2;
default:
V_text_nothing = true;
lcd.setCursor (0, 3);
lcd.print (text_nothing);
Serial.println ('\n');
Serial.print (text_nothing);
Serial.println ('\n');
goto pokracovat_2;
}
pokracovat_2:
if (V_text_nothing == true)
{
lcd.setCursor (10, 3);
lcd.print (text_CONTINUE);
}
Serial.println ('\n');
Serial.print (text_time);
delay (time / 4);
Serial.println ('\n');
Serial.print (text_end_lesson_1);
Serial.println ('\n');
digitalWrite (pin_on_off, HIGH); // vypnuto
delay (250);
digitalWrite (pin_on_off, LOW);
delay (250);
digitalWrite (pin_safety_switch, LOW);
lcd.clear ();
lcd.setCursor (4, 1);
lcd.print (text_end_lesson_2);
delay (3000);
banned = 0;
break;
case 10:
case 3: // program 3 ST. ( 5 )
lcd.clear ();
lcd.setCursor (1, 0);
lcd.print (text_program_3_1);
Serial.println ('\n');
Serial.print (text_program_3_2);
digitalWrite (pin_on_off, HIGH); // zapnuto
delay (250);
digitalWrite (pin_on_off, LOW);
delay (250);
for (int i = 0; i < 4; i++) // 4x mode
{
digitalWrite (pin_mode, HIGH);
delay (250);
digitalWrite (pin_mode, LOW);
delay (250);
}
intensity = random (1, inte_3); // intenzita
lcd.setCursor (1, 1);
lcd.print (text_intensity_1);
lcd.setCursor (11, 1);
lcd.print (intensity);
Serial.print (" ");
Serial.print (text_intensity_2);
Serial.print (intensity);
Serial.print (" ");
digitalWrite (pin_safety_switch, HIGH);
lcd.setCursor (16, 0);
lcd.print (" ");
time = random (time_min, time_max); // delka
lcd.setCursor (1, 2);
lcd.print (text_Length);
lcd.setCursor (7, 2);
lcd.print (time / 1000 / 60);
lcd.setCursor (12, 2);
lcd.print (text_minute_1);
Serial.print (text_Length);
Serial.print (time / 1000);
Serial.print (text_seconds_2);
Serial.print (time / 1000 / 60);
Serial.print (text_minute_2);
Serial.println ('\n');
delay (5000);
for (int i = 0; i < intensity; i++)
{
digitalWrite (pin_intensity, HIGH);
delay (250);
digitalWrite (pin_intensity, LOW);
delay (1000);
}
delay (time / 4 * 3);
extra = random (30, 36); // volba pridavku
switch (extra)
{
case 30:
lcd.setCursor (1, 3);
lcd.print (text_st_1);
Serial.println ('\n');
Serial.print (text_st_1);
Serial.println ('\n');
digitalWrite (pin_intensity, HIGH);
delay (250);
digitalWrite (pin_intensity, LOW);
delay (250);
delay (3000);
goto pokracovat_3;
case 31:
lcd.setCursor (1, 3);
lcd.print (text_st_2);
Serial.println ('\n');
Serial.print (text_st_2);
Serial.println ('\n');
for (int i = 0; i < 3; i++)
{
digitalWrite (pin_intensity, HIGH);
delay (250);
digitalWrite (pin_intensity, LOW);
delay (1000);
}
delay (3000);
goto pokracovat_3;
case 32:
extra_time = random ((time / 10), (time /2));
lcd.setCursor (1, 3);
lcd.print (text_more_time);
lcd.setCursor (7, 3);
lcd.print (extra_time / 1000);
lcd.setCursor (11, 3);
lcd.print ("s ");
Serial.println ('\n');
Serial.print (text_more_time);
Serial.print (extra_time / 1000);
Serial.print (text_seconds_1);
Serial.print (extra_time / 1000 / 60);
Serial.print (text_minute_2);
delay (extra_time);
goto pokracovat_3;
default:
V_text_nothing = true;
lcd.setCursor (0, 3);
lcd.print (text_nothing);
Serial.println ('\n');
Serial.print (text_nothing);
Serial.println ('\n');
goto pokracovat_3;
}
pokracovat_3:
if (V_text_nothing == true)
{
lcd.setCursor (10, 3);
lcd.print (text_CONTINUE);
}
Serial.println ('\n');
Serial.print (text_time);
delay (time / 4);
Serial.println ('\n');
Serial.print (text_end_lesson_1);
Serial.println('\n');
digitalWrite (pin_on_off, HIGH); // vypnuto
delay (250);
digitalWrite (pin_on_off, LOW);
delay (250);
digitalWrite (pin_safety_switch, LOW);
lcd.clear ();
lcd.setCursor (4, 1);
lcd.print (text_end_lesson_2);
banned = 0;
break;
case 9:
case 4: // program 4 ST. ( 6 )
lcd.clear ();
lcd.setCursor (1, 0);
lcd.print (text_program_4_1);
Serial.println ('\n');
Serial.print (text_program_4_2);
digitalWrite (pin_on_off, HIGH); // zapnuto
delay (250);
digitalWrite (pin_on_off, LOW);
delay (250);
for (int i = 0; i < 5; i++) // 5x mode
{
digitalWrite (pin_mode, HIGH);
delay (250);
digitalWrite (pin_mode, LOW);
delay (250);
}
intensity = random (1, inte_4); // intenzita
lcd.setCursor (1, 1);
lcd.print (text_intensity_1);
lcd.setCursor (11, 1);
lcd.print (intensity);
Serial.print (" ");
Serial.print ("Intenzita ");
Serial.print (intensity);
Serial.print (" ");
digitalWrite (pin_safety_switch, HIGH);
lcd.setCursor (16, 0);
lcd.print (" ");
time = random (time_min, time_max); // delka
lcd.setCursor (1, 2);
lcd.print (text_Length);
lcd.setCursor (7, 2);
lcd.print (time / 1000 / 60);
lcd.setCursor (12, 2);
lcd.print (text_minute_1);
Serial.print (text_Length);
Serial.print (time / 1000);
Serial.print (text_seconds_2);
Serial.print (time / 1000 / 60);
Serial.print (text_minute_2);
Serial.println ('\n');
delay (5000);
for (int i = 0; i < intensity; i++)
{
digitalWrite (pin_intensity, HIGH);
delay (250);
digitalWrite (pin_intensity, LOW);
delay (1000);
}
delay (time / 4 * 3);
extra = random (40, 46); // volba pridavku
switch (extra)
{
case 40:
lcd.setCursor (1, 3);
lcd.print (text_st_1);
Serial.println ('\n');
Serial.print (text_st_1);
Serial.println ('\n');
digitalWrite (pin_intensity, HIGH);
delay (250);
digitalWrite (pin_intensity, LOW);
delay (250);
delay (3000);
goto pokracovat_4;
case 41:
lcd.setCursor (1, 3);
lcd.print (text_st_2);
Serial.println ('\n');
Serial.print (text_st_2);
Serial.println ('\n');
for (int i = 0; i < 3; i++)
{
digitalWrite (pin_intensity, HIGH);
delay (250);
digitalWrite (pin_intensity, LOW);
delay (1000);
}
delay (3000);
goto pokracovat_4;
case 42:
extra_time = random ((time / 10), (time /2));
lcd.setCursor (1, 3);
lcd.print (text_more_time);
lcd.setCursor (7, 3);
lcd.print (extra_time / 1000);
lcd.setCursor (11, 3);
lcd.print ("s ");
Serial.println ('\n');
Serial.print (text_more_time);
Serial.print (extra_time / 1000);
Serial.print (text_seconds_1);
Serial.print (extra_time / 1000 / 60);
Serial.print (text_minute_2);
delay (extra_time);
goto pokracovat_4;
default:
V_text_nothing = true;
lcd.setCursor (0, 3);
lcd.print (text_nothing);
Serial.println ('\n');
Serial.print (text_nothing);
Serial.println ('\n');
goto pokracovat_4;
}
pokracovat_4:
if (V_text_nothing == true)
{
lcd.setCursor (10, 3);
lcd.print (text_CONTINUE);
}
Serial.println ('\n');