This repository has been archived by the owner on Aug 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kody.php
824 lines (759 loc) · 22.2 KB
/
kody.php
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
<?php
error_reporting(0);
session_start();
if ($_SESSION['login']===true){ ?>
<!DOCTYPE html>
<html lang="cz">
<head>
<title>Webaplikácia - Ovládanie relé</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="icon.png" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript">
window.smartlook||(function(d) {
var o=smartlook=function(){ o.api.push(arguments)},h=d.getElementsByTagName('head')[0];
var c=d.createElement('script');o.api=new Array();c.async=true;c.type='text/javascript';
c.charset='utf-8';c.src='https://rec.smartlook.com/recorder.js';h.appendChild(c);
})(document);
smartlook('init', 'db50efe9fff280a17db52b82be221240cbbd3dbe');
</script>
<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-76290977-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-76290977-2');
</script>
<style>
.navbar {
margin-bottom: 0;
border-radius: 0;
}
/* Add a gray background color and some padding to the footer */
footer {
background-color: #f2f2f2;
padding: 25px;
}
.carousel-inner img {
width: 100%; /* Set width to 100% */
margin: auto;
min-height:200px;
}
/* Hide the carousel text when the screen is less than 600 pixels wide */
@media (max-width: 600px) {
.carousel-caption {
display: none;
}
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #111;
}
@media screen and (max-width: 600px){
ul.topnav li.right,
ul.topnav li {float: none;}
}
.floatLeft { width: 50%; float: left; }
.floatRight {width: 50%; float: right; }
.container { overflow: hidden; }
label {
display: inline-block;
width: 100px;
height: 30px;
border: 3px solid rgba(0,0,0,0.07);
border-radius: 17px;
position: relative;
box-shadow: inset 1px 1px 1px 1px rgba(0,0,0,0.4), 0px 0px 0px 1px rgba(0,0,0,0.1), 0px 0px 0px 2px rgba(0,0,0,0.1), 0px 0px 4px 2px rgba(0,0,0,0.07);
}
input[type=checkbox] {
display: none;
}
input:checked ~ a {
left: 50%;
}
input:checked ~ div span {
background-color: rgba(0,158,255,0.5);
}
label div {
}
label span {
z-index: 1;
position: absolute;
display: inline-block;
height: 28px;
left: 0;
width: 49%;
border-radius: 15px 0px 0px 15px;
border-color: rgba(0,0,0,0.1);
border-style: solid;
border-width: 1px 0px 1px 1px;
background-color: rgba(200,200,200,0.5);
background-image:-webkit-linear-gradient(90deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.0) 100%);
text-align: center;
line-height: 30px;
font-family: helvetica, sans-serif;
font-size: 14px;
font-weight: 800;
color: #555;
text-shadow: 0px 1px white;
-webkit-transition: all 1.0s ease-in-out;
-moz-transition: all 1.0s ease-in-out;
transition: all 1.0s ease-in-out;
}
label span.no {
left: 50%;
border-radius: 0px 15px 15px 0px;
border-width: 1px 1px 1px 0px;
}
.slider {
display: inline-block;
position: absolute;
width: 50%;
height: 28px;
background-color: #efefef;
left: 0%;
border-radius: 30px;
z-index: 2;
border: 1px solid rgba(0,0,0,0.2);
box-shadow: inset 0px 0px 5px 1px rgba(0,0,0,0.1), 0px 1px 1px 0px rgba(0,0,0,0.2);
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
}
.slider:after, .slider:before {
content: "";
width: 30%;
height: 25px;
position: absolute;
top: 2px;
border-radius: 50%;
}
.slider:after {
left: 15%;
background-image:-webkit-linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.0) 100%);
}
.slider:before {
right: 15%;
background-image:-webkit-linear-gradient(0deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.0) 100%);
}
/* fluff */
form {
width: 250px;
margin: 0px auto;
margin-top: 20px;
font-family: georgia, times, serif;
box-shadow: 0px 0px 10px 2px rgba(0,0,0,0.2);
border-radius: 5px;
padding: 25px;
background-color: #fff;
}
fieldset {
border: 1px solid #ccc;
padding: 20px;
text-align: center;
border-radius: 3px;
color: #666;
margin-bottom: 20px;
}
h1 {
background-color: rgba(0,158,255,0.5);
margin: -25px -25px 25px -25px;
padding: 10px;
border-radius: 5px 5px 0px 0px;
text-align: center;
font-family: 'Helvetica Neue', Helvetica, sans-serif;
font-weight: 500;
letter-spacing: 1px;
color: #fff;
background-image: -webkit-linear-gradient(90deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.0) 100%);
text-shadow: 0px 2px 0px rgba(0,0,0,0.5);
}
</style>
</head>
<body>
<ul>
<li><a href="system.php">Prehľad</a></li>
<li><a href="scheduler.php">Scheduler</a></li>
<li><a href="zmenaloginu.php">Zmena loginu</a></li>
<li><a class="active" href="kody.php">Arduino kódy</a></li>
<li style="float:right;"><a href="logout.php">Odhlásiť sa</a></li>
</ul>
<center><h2>Arduino 1</h2></center>
<pre>
#include <avr\wdt.h> //kniznica watchdogu
#include <SPI.h> //kniznica SPI
#include <Ethernet.h> //kniznica k ethernet shieldu
const int rele1 = 22; //rele 1 na pine D22
const int rele2 = 23; //rele 2 na pine D23
const int rele3 = 24; //rele 3 na pine D24
const int rele4 = 25; //rele 4 na pine D25
const int rele5 = 26; //rele 5 na pine D26
const int rele6 = 27; //rele 6 na pine D27
const int rele7 = 28; //rele 7 na pine D28
const int rele8 = 29; //rele 8 na pine D29
const int rele9 = 30; //rele 9 na pine D30
const int rele10 = 31; //rele 10 na pine D31
const int rele11 = 32; //rele 11 na pine D32
const int rele12 = 33; //rele 12 na pine D33
const int rele13 = 34; //rele 13 na pine D34
const int rele14 = 35; //rele 15 na pine D35
const int rele15 = 36; //rele 15 na pine D36
const int rele16 = 37; //rele 16 na pine D37
byte mac[] = { 0x20, 0x1A, 0x06, 0x75, 0x8C, 0xAA };
char server[] = "www.arduino.php5.sk";
IPAddress dnServer(192, 168, 1, 1);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress ip(192, 168, 1, 150);
EthernetClient client;
void setup() {
pinMode(rele1, OUTPUT);
pinMode(rele2, OUTPUT);
pinMode(rele3, OUTPUT);
pinMode(rele4, OUTPUT);
pinMode(rele5, OUTPUT);
pinMode(rele6, OUTPUT);
pinMode(rele7, OUTPUT);
pinMode(rele8, OUTPUT);
pinMode(rele9, OUTPUT);
pinMode(rele10, OUTPUT);
pinMode(rele11, OUTPUT);
pinMode(rele12, OUTPUT);
pinMode(rele13, OUTPUT);
pinMode(rele14, OUTPUT);
pinMode(rele15, OUTPUT);
pinMode(rele16, OUTPUT);
Serial.begin(9600);
if (Ethernet.begin(mac) == 0) { //V PRIPADE ZLYHANIA NASTAVENIA DHCP
Serial.println("Chyba konfiguracie, manualne nastavenie");
Ethernet.begin(mac, ip, dnServer, gateway, subnet);
delay(500);
}
wdt_enable(WDTO_8S); //8 sekundovy watchdog
}
void loop() {
wdt_reset();
if (Ethernet.begin(mac) == 0) {
Serial.println("Chyba konfiguracie, manualne nastavenie");
Ethernet.begin(mac, ip, dnServer, gateway, subnet);
wdt_reset();
delay(500);
}
wdt_reset();
aktualizuj_vystupy();
wdt_reset();
vystup_rele1();
wdt_reset();
vystup_rele2();
wdt_reset();
vystup_rele3();
wdt_reset();
vystup_rele4();
wdt_reset();
vystup_rele5();
wdt_reset();
vystup_rele6();
wdt_reset();
vystup_rele7();
wdt_reset();
vystup_rele8();
wdt_reset();
vystup_rele9();
wdt_reset();
vystup_rele10();
wdt_reset();
vystup_rele11();
wdt_reset();
vystup_rele12();
wdt_reset();
vystup_rele13();
wdt_reset();
vystup_rele14();
wdt_reset();
vystup_rele15();
wdt_reset();
vystup_rele16();
for (int i = 0; i <= 300; i++) {
delay(1000);
wdt_reset();
}
}
void vystup_rele1() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele1.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 1 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele1, LOW);
Serial.println("Zapinam rele 1");
} else if (premenna == "VYP") {
digitalWrite(rele1, HIGH);
Serial.println("Vypinam rele 1");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 1");
}
client.stop();
}
void vystup_rele2() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele2.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 2 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele2, LOW);
Serial.println("Zapinam rele 2");
} else if (premenna == "VYP") {
digitalWrite(rele2, HIGH);
Serial.println("Vypinam rele 2");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 2");
}
client.stop();
}
void vystup_rele3() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele3.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 3 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele3, LOW);
Serial.println("Zapinam rele 3");
} else if (premenna == "VYP") {
digitalWrite(rele3, HIGH);
Serial.println("Vypinam rele 3");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 3");
}
client.stop();
}
void vystup_rele4() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele4.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 4 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele4, LOW);
Serial.println("Zapinam rele 4");
} else if (premenna == "VYP") {
digitalWrite(rele4, HIGH);
Serial.println("Vypinam rele 4");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 4");
}
client.stop();
}
void vystup_rele5() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele5.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 5 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele5, LOW);
Serial.println("Zapinam rele 5");
} else if (premenna == "VYP") {
digitalWrite(rele5, HIGH);
Serial.println("Vypinam rele 5");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 5");
}
client.stop();
}
void vystup_rele6() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele6.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 6 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele6, LOW);
Serial.println("Zapinam rele 6");
} else if (premenna == "VYP") {
digitalWrite(rele6, HIGH);
Serial.println("Vypinam rele 6");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 6");
}
client.stop();
}
void vystup_rele7() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele7.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 7 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele7, LOW);
Serial.println("Zapinam rele 7");
} else if (premenna == "VYP") {
digitalWrite(rele7, HIGH);
Serial.println("Vypinam rele 7");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 7");
}
client.stop();
}
void vystup_rele8() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele8.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 8 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele8, LOW);
Serial.println("Zapinam rele 8");
} else if (premenna == "VYP") {
digitalWrite(rele8, HIGH);
Serial.println("Vypinam rele 8");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 8");
}
client.stop();
}
void vystup_rele9() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele9.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 9 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele9, LOW);
Serial.println("Zapinam rele 9");
} else if (premenna == "VYP") {
digitalWrite(rele9, HIGH);
Serial.println("Vypinam rele 9");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 9");
}
client.stop();
}
void vystup_rele10() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele10.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 10 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele10, LOW);
Serial.println("Zapinam rele 10");
} else if (premenna == "VYP") {
digitalWrite(rele10, HIGH);
Serial.println("Vypinam rele 10");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 10");
}
client.stop();
}
void vystup_rele11() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele11.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 11 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele11, LOW);
Serial.println("Zapinam rele 11");
} else if (premenna == "VYP") {
digitalWrite(rele11, HIGH);
Serial.println("Vypinam rele 11");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 11");
}
client.stop();
}
void vystup_rele12() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele12.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 12 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele12, LOW);
Serial.println("Zapinam rele 12");
} else if (premenna == "VYP") {
digitalWrite(rele12, HIGH);
Serial.println("Vypinam rele 12");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 12");
}
client.stop();
}
void vystup_rele13() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele13.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 13 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele13, LOW);
Serial.println("Zapinam rele 13");
} else if (premenna == "VYP") {
digitalWrite(rele13, HIGH);
Serial.println("Vypinam rele 13");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 13");
}
client.stop();
}
void vystup_rele14() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele14.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 14 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele14, LOW);
Serial.println("Zapinam rele 14");
} else if (premenna == "VYP") {
digitalWrite(rele14, HIGH);
Serial.println("Vypinam rele 14");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 14");
}
client.stop();
}
void vystup_rele15() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele15.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 15 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele15, LOW);
Serial.println("Zapinam rele 15");
} else if (premenna == "VYP") {
digitalWrite(rele15, HIGH);
Serial.println("Vypinam rele 15");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 15");
}
client.stop();
}
void vystup_rele16() {
if (client.connect(server, 80)) {
client.println("GET /rele2/arduino1/rele16.txt HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Pripojenie k vystupu rele 16 uspesne");
while (client.connected()) {
String hlavicka = client.readStringUntil('\n');
Serial.println(hlavicka);
if (hlavicka == "\r") {
break;
}
}
String premenna = client.readStringUntil('\n');
if (premenna == "ZAP") {
digitalWrite(rele16, LOW);
Serial.println("Zapinam rele 16");
} else if (premenna == "VYP") {
digitalWrite(rele16, HIGH);
Serial.println("Vypinam rele 16");
}
} else {
Serial.println("Neuspesne pripojenie pre ziskanie vystupu rele 16");
}
client.stop();
}
void aktualizuj_vystupy() {
if (client.connect(server, 80)) {
client.print("GET /rele2/over-rele.php");
client.println(" HTTP/1.1");
client.println("Host: www.arduino.php5.sk");
client.println("Connection: close");
client.println();
Serial.println("Vystupy aktualizovane");
} else {
Serial.println("Neuspesne pripojenie pre aktualizaciu vystupov");
}
client.stop();
}
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
}else{
header('LOCATION: index.php');
}
?>