Маленький заказик на "полбайта" :)
- Войдите на сайт для отправки комментариев
Ср, 08/10/2014 - 19:07
Доброго всем !
есть желающие помочь человеку с имеющимся скетчем:
Надо поменять термодатчик , там тиристор какой то, а надо прописать DS18B20 , а лучше даж что бы было 2-3 датчика. Если возможно конечно.
собственно сам скетч находится здесь
http://www.instructables.com/id/Ethernet-Switching-with-Arduino/step3/Et...
там дальше есть версия поддерживающая нужный датчик, но чета она у меня не компилится.
А я бы доброму человеку потратившему на меня полчасика, закинул бы денег на телефон ...
Круто, хочу заместо колеса что бы лыжу прикрутить, а лучше что бы 3 лыжи, а то на колесах все время в воде тонет. И что бы в полчаса уложиться. Работы на половинку поворота отверточкой.
нет, ну если работа такая сложная, то и фик на неё, так проживём.
Просто я баловался скетчами с этими термодачиками, сложного ничего не увидел, подумал что местным профи это на "полбайта", а мне так день уйдёт..
Лучше день потерять , потом за час долететь! (С) старый мультик про хвост.
Лучше день потерять , потом за час долететь! (С)
Не, правильно вот так: Лучше деньги потерять , но за полчаса долететь! (С)
001
////////////////////////////////////////////////////////////////////////
002
//ETHERNET SWITCH PROGRAM
003
////////////////////////////////////////////////////////////////////////
004
//
005
//Intro:
006
//This will switch on and off outputs trough your mobile device.
007
//No images or links to images. CSS3 and HTML5 use.
008
//Though it work with other web browser, we suggest Safari for best experiance.
009
//
010
//Version: Web Server Ethernet Switching Version 4.06
011
//Author: Claudio Vella - Malta
012
//Initial code from: <a href="http://bildr.org/2011/06/arduino-ethernet-pin-control/" rel="nofollow">http://bildr.org/2011/06/arduino-ethernet-pin-control/</a>
013
//Made lot of comments for beginners.
014
//
015
// Requests
016
// 1. To invert the outputs. - Done on V3.06
017
// 2. A possibility to rename the buttons - Done on V4.06
018
// 3. To be password protected.
019
// 4. Refresh page settable. - Done on V3.06
020
// 5 Switch On or Off the outputs on startup - Done on V3.06
021
// 6. Enable/Disable the All on/off buttons - Done on V4.01
022
// 7. Read Temperature - Done on V4.03
023
// 8. Save/Load statuses from eeprom to keep latest status after powercut - Done on V4.06
024
// 9. Option to choose which output to retain the value after power cut. - Done on V4.06
025
026
027
028
//ARDUINO 1.0+ ONLY
029
030
031
#include <Ethernet.h>
032
#include <SPI.h>
033
#include <EEPROM.h>
034
#include <OneWire.h>
035
#include <ds18b20.h>
036
037
038
////////////////////////////////////////////////////////////////////////
039
//CONFIGURATION
040
////////////////////////////////////////////////////////////////////////
041
042
//IP manual settings
043
byte
ip[] = {
044
192, 168, 1, 177 };
//Manual setup only
045
byte
gateway[] = {
046
192, 168, 1, 254 };
//Manual setup only
047
byte
subnet[] = {
048
255, 255, 255, 0 };
//Manual setup only
049
050
// if need to change the MAC address (Very Rare)
051
byte
mac[] = {
052
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
053
054
//Ethernet Port
055
EthernetServer server = EthernetServer(80);
//default html port 80
056
057
//The number of outputs going to be switched.
058
int
outputQuantity = 10;
//should not exceed 10
059
060
//Invert the output of the leds
061
boolean outputInverted =
false
;
//true or false
062
// This is done in case the relay board triggers the relay on negative, rather then on positive supply
063
064
//Html page refresh
065
int
refreshPage = 15;
//default is 10sec.
066
//Beware that if you make it refresh too fast, the page could become inacessable.
067
068
//Display or hide the "Switch on all Pins" buttons at the bottom of page
069
int
switchOnAllPinsButton =
false
;
//true or false
070
071
//Button Array
072
//Just for a note, varables start from 0 to 9, as 0 is counted as well, thus 10 outputs.
073
074
// Select the pinout address
075
int
outputAddress[10] = { 3,5,6,7,8,9,14,15,16,17};
//Allocate 10 spaces and name the output pin address.
076
//PS pin addresses 10, 11, 12 and 13 on the Duemilanove are used for the ethernet shield, therefore cannot be used.
077
//PS pin addresses 10, 50, 51 and 52 and 53 on the Mega are used for the ethernet shield, therefore cannot be used.
078
//PS pin addresses 4, are used for the SD card, therefore cannot be used.
079
//PS. pin address 2 is used for interrupt-driven notification, therefore could not be used.
080
081
// Write the text description of the output channel
082
String buttonText[10] = {
083
"01. Right Lamp"
,
"02. Left Lamp"
,
"03. Bedroom"
,
"04. Kitchen"
,
"05. Water Heater"
,
"06. Gate"
,
"07. Toilet"
,
"08. Main Heater"
,
"09. Roof Light"
,
"10. Basement"
};
084
085
// Set the output to retain the last status after power recycle.
086
int
retainOutputStatus[10] = {1,0,0,0,1,1,1,1,1,1};
//1-retain the last status. 0-will be off after power cut.
087
088
////////////////////////////////////////////////////////////////////////
089
090
////////////////////////////////////////////////////////////////////////
091
//VARIABLES DECLARATION
092
////////////////////////////////////////////////////////////////////////
093
int
outp = 0;
094
boolean printLastCommandOnce =
false
;
095
boolean printButtonMenuOnce =
false
;
096
boolean initialPrint =
true
;
097
String allOn =
""
;
098
String allOff =
""
;
099
boolean reading =
false
;
100
boolean outputStatus[10];
//Create a boolean array for the maximum ammount.
101
String rev =
"V4.06"
;
102
unsigned
long
timeConnectedAt;
103
boolean writeToEeprom =
false
;
104
//EthernetClient client;
105
106
107
108
109
/////////////////////////////////////////////////
110
111
// Temperature Related Reading
112
113
#define tSensors 2 //2 sensors
114
DS18B20 ds(9, tSensors);
//Pin 9, 2 chips
115
float
tempOutDeg[tSensors];
116
117
118
119
////////////////////////////////////////////////////////////////////////
120
//RUN ONCE
121
////////////////////////////////////////////////////////////////////////
122
//Beginning of Program
123
void
setup
(){
124
Serial
.begin(9600);
125
126
initEepromValues();
127
readEepromValues();
128
//Init themp array
129
for
(
byte
i = 0;i<tSensors;i++){
130
tempOutDeg[i] = 0.0;
131
}
132
//Set pins as Outputs
133
boolean currentState =
false
;
134
for
(
int
var = 0; var < outputQuantity; var++){
135
136
pinMode(outputAddress[var], OUTPUT);
137
138
//Switch all outputs to either on or off on Startup
139
if
(outputInverted ==
true
) {
140
//digitalWrite(outputAddress[var], HIGH);
141
if
(outputStatus[var] == 0){currentState =
true
;}
else
{currentState =
false
;}
//check outputStatus if off, switch output accordingly
142
digitalWrite(outputAddress[var], currentState);
143
144
}
145
else
{
146
147
//digitalWrite(outputAddress[var], LOW);
148
if
(outputStatus[var] == 0){currentState =
false
;}
else
{currentState =
true
;}
//check outputStatus if off, switch output accordingly
149
digitalWrite(outputAddress[var], currentState);
150
}
151
152
}
153
154
//Setting up the IP address. Comment out the one you dont need.
155
//Ethernet.begin(mac); //for DHCP address. (Address will be printed to serial.)
156
Ethernet.begin(mac, ip, gateway, subnet);
//for manual setup. (Address is the one configured above.)
157
158
159
server.begin();
160
Serial
.print(
"Server started at "
);
161
Serial
.println(Ethernet.localIP());
162
}
163
164
165
////////////////////////////////////////////////////////////////////////
166
//LOOP
167
////////////////////////////////////////////////////////////////////////
168
//Run once
169
void
loop
(){
170
171
172
//Read Temperature Sensor
173
// initialize() scans the bus for sensors
174
ds.initialize();
175
for
(
byte
i=0;i<tSensors;i++){
176
// ask for a temperature conversion from sensor num i
177
ds.start_conversion(i);
178
// read the scratchpad on the other side
179
ds.read_scratchpad(i);
180
tempOutDeg[i] = ds.read_temperature();
181
}
182
183
184
// listen for incoming clients, and process requests.
185
checkForClient();
186
}
187
188
////////////////////////////////////////////////////////////////////////
189
//checkForClient Function
190
////////////////////////////////////////////////////////////////////////
191
//
192
void
checkForClient(){
193
194
EthernetClient client = server.available();
195
196
if
(client) {
197
198
// an http request ends with a blank line
199
boolean currentLineIsBlank =
true
;
200
boolean sentHeader =
false
;
201
202
while
(client.connected()) {
203
if
(client.available()) {
204
205
//if header was not set send it
206
207
//read user input
208
char
c = client.read();
209
210
if
(c ==
'*'
){
211
212
printHtmlHeader(client);
//call for html header and css
213
printLoginTitle(client);
214
printHtmlFooter(client);
215
//sentHeader = true;
216
break
;
217
}
218
219
if
(!sentHeader){
220
221
printHtmlHeader(client);
//call for html header and css
222
printHtmlButtonTitle(client);
//print the button title
223
224
//This is for the arduino to construct the page on the fly.
225
sentHeader =
true
;
226
}
227
228
//read user input
229
// char c = client.read();
230
231
//if there was reading but is blank there was no reading
232
if
(reading && c ==
' '
){
233
reading =
false
;
234
}
235
236
//if there is a ? there was user input
237
if
(c ==
'?'
) {
238
reading =
true
;
//found the ?, begin reading the info
239
}
240
241
// if there was user input switch the relevant output
242
if
(reading){
243
244
//if user input is H set output to 1
245
if
(c ==
'H'
) {
246
outp = 1;
247
}
248
249
//if user input is L set output to 0
250
if
(c ==
'L'
) {
251
outp = 0;
252
}
253
254
Serial
.print(c);
//print the value of c to serial communication
255
//Serial.print(outp);
256
//Serial.print('\n');
257
258
switch
(c) {
259
260
case
'0'
:
261
//add code here to trigger on 0
262
triggerPin(outputAddress[0], client, outp);
263
break
;
264
case
'1'
:
265
//add code here to trigger on 1
266
triggerPin(outputAddress[1], client, outp);
267
break
;
268
case
'2'
:
269
//add code here to trigger on 2
270
triggerPin(outputAddress[2], client, outp);
271
break
;
272
case
'3'
:
273
//add code here to trigger on 3
274
triggerPin(outputAddress[3], client, outp);
275
break
;
276
case
'4'
:
277
//add code here to trigger on 4
278
triggerPin(outputAddress[4], client, outp);
279
break
;
280
case
'5'
:
281
//add code here to trigger on 5
282
triggerPin(outputAddress[5], client, outp);
283
//printHtml(client);
284
break
;
285
case
'6'
:
286
//add code here to trigger on 6
287
triggerPin(outputAddress[6], client, outp);
288
break
;
289
case
'7'
:
290
//add code here to trigger on 7
291
triggerPin(outputAddress[7], client, outp);
292
break
;
293
case
'8'
:
294
//add code here to trigger on 8
295
triggerPin(outputAddress[8], client, outp);
296
break
;
297
case
'9'
:
298
//add code here to trigger on 9
299
triggerPin(outputAddress[9], client, outp);
300
break
;
301
}
//end of switch case
302
303
}
//end of switch switch the relevant output
304
305
//if user input was blank
306
if
(c ==
'\n'
&& currentLineIsBlank){
307
printLastCommandOnce =
true
;
308
printButtonMenuOnce =
true
;
309
triggerPin(777, client, outp);
//Call to read input and print menu. 777 is used not to update any outputs
310
break
;
311
}
312
313
314
315
316
}
317
}
318
319
printHtmlFooter(client);
//Prints the html footer
320
321
}
322
else
323
{
//if there is no client
324
325
//And time of last page was served is more then a minute.
326
if
(millis() > (timeConnectedAt + 60000)){
327
328
if
(writeToEeprom ==
true
){
329
writeEepromValues();
//write to EEprom the current output statuses
330
Serial
.println(
"No Clients for more then a minute - Writing statuses to Eeprom."
);
331
writeToEeprom =
false
;
332
}
333
334
}
335
}
336
337
338
}
339
340
341
////////////////////////////////////////////////////////////////////////
342
//triggerPin Function
343
////////////////////////////////////////////////////////////////////////
344
//
345
void
triggerPin(
int
pin, EthernetClient client,
int
outp){
346
//Switching on or off outputs, reads the outputs and prints the buttons
347
348
//Setting Outputs
349
if
(pin != 777){
350
351
if
(outp == 1) {
352
if
(outputInverted ==
false
){
353
digitalWrite(pin, HIGH);
354
}
355
else
{
356
digitalWrite(pin, LOW);
357
}
358
}
359
if
(outp == 0){
360
if
(outputInverted ==
false
){
361
digitalWrite(pin, LOW);
362
}
363
else
{
364
digitalWrite(pin, HIGH);
365
}
366
}
367
368
369
}
370
//Refresh the reading of outputs
371
readOutputStatuses();
372
373
374
//Prints the buttons
375
if
(printButtonMenuOnce ==
true
){
376
printHtmlButtons(client);
377
printButtonMenuOnce =
false
;
378
}
379
380
}
381
382
////////////////////////////////////////////////////////////////////////
383
//printHtmlButtons Function
384
////////////////////////////////////////////////////////////////////////
385
//print the html buttons to switch on/off channels
386
void
printHtmlButtons(EthernetClient client){
387
388
//Start to create the html table
389
client.println(
""
);
390
//client.println("<p>");
391
client.println(
"<FORM>"
);
392
client.println(
"<table border=\"0\" align=\"center\">"
);
393
394
for
(
byte
i =0;i<tSensors;i++){
395
//Printing the Temperature
396
client.print(
"<tr>\n"
);
397
398
client.print(
"<td><h4>"
);
399
client.print(
"Temperature "
);
400
client.print(i+1);
401
client.print(
"</h4></td>\n"
);
402
client.print(
"<td></td>"
);
403
client.print(
"<td>"
);
404
client.print(
"<h3>"
);
405
client.print(tempOutDeg[i]);
406
client.print(
" °C</h3></td>\n"
);
407
408
409
client.print(
"<td></td>"
);
410
client.print(
"</tr>"
);
411
}
412
413
//Start printing button by button
414
for
(
int
var = 0; var < outputQuantity; var++) {
415
416
//set command for all on/off
417
allOn +=
"H"
;
418
allOn += outputAddress[var];
419
allOff +=
"L"
;
420
allOff += outputAddress[var];
421
422
423
//Print begining of row
424
client.print(
"<tr>\n"
);
425
426
//Prints the button Text
427
client.print(
"<td><h4>"
);
428
client.print(buttonText[var]);
429
client.print(
"</h4></td>\n"
);
430
431
//Prints the ON Buttons
432
client.print(
"<td>"
);
433
//client.print(buttonText[var]);
434
client.print(
"<INPUT TYPE=\"button\" VALUE=\"ON "
);
435
//client.print(buttonText[var]);
436
client.print(
"\" onClick=\"parent.location='/?H"
);
437
client.print(var);
438
client.print(
"'\"></td>\n"
);
439
440
//Prints the OFF Buttons
441
client.print(
" <td><INPUT TYPE=\"button\" VALUE=\"OFF"
);
442
//client.print(var);
443
client.print(
"\" onClick=\"parent.location='/?L"
);
444
client.print(var);
445
client.print(
"'\"></td>\n"
);
446
447
448
//Print first part of the Circles or the LEDs
449
450
//Invert the LED display if output is inverted.
451
452
if
(outputStatus[var] ==
true
){
//If Output is ON
453
if
(outputInverted ==
false
){
//and if output is not inverted
454
client.print(
" <td><div class='green-circle'><div class='glare'></div></div></td>\n"
);
//Print html for ON LED
455
}
456
else
{
//else output is inverted then
457
client.print(
" <td><div class='black-circle'><div class='glare'></div></div></td>\n"
);
//Print html for OFF LED
458
}
459
}
460
else
//If Output is Off
461
{
462
if
(outputInverted ==
false
){
//and if output is not inverted
463
client.print(
" <td><div class='black-circle'><div class='glare'></div></div></td>\n"
);
//Print html for OFF LED
464
}
465
else
{
//else output is inverted then
466
client.print(
" <td><div class='green-circle'><div class='glare'></div></div></td>\n"
);
//Print html for ON LED
467
}
468
}
469
470
471
472
473
//Print end of row
474
client.print(
"</tr>\n"
);
475
}
476
477
//Display or hide the Print all on Pins Button
478
if
(switchOnAllPinsButton ==
true
){
479
480
//Prints the ON All Pins Button
481
client.print(
"<tr>\n<td><INPUT TYPE=\"button\" VALUE=\"Switch ON All Pins"
);
482
client.print(
"\" onClick=\"parent.location='/?"
);
483
client.print(allOn);
484
client.print(
"'\"></td>\n"
);
485
486
//Prints the OFF All Pins Button
487
client.print(
"<td><INPUT TYPE=\"button\" VALUE=\"Switch OFF All Pins"
);
488
client.print(
"\" onClick=\"parent.location='/?"
);
489
client.print(allOff);
490
client.print(
"'\"></td>\n<td></td>\n<td></td>\n</tr>\n"
);
491
}
492
493
//Closing the table and form
494
client.println(
"</table>"
);
495
client.println(
"</FORM>"
);
496
//client.println("</p>");
497
498
}
499
500
////////////////////////////////////////////////////////////////////////
501
//readOutputStatuses Function
502
////////////////////////////////////////////////////////////////////////
503
//Reading the Output Statuses
504
void
readOutputStatuses(){
505
for
(
int
var = 0; var < outputQuantity; var++) {
506
outputStatus[var] = digitalRead(outputAddress[var]);
507
//Serial.print(outputStatus[var]);
508
}
509
510
}
511
512
////////////////////////////////////////////////////////////////////////
513
//readEepromValues Function
514
////////////////////////////////////////////////////////////////////////
515
//Read EEprom values and save to outputStatus
516
void
readEepromValues(){
517
for
(
int
adr = 0; adr < outputQuantity; adr++) {
518
outputStatus[adr] = EEPROM.read(adr);
519
}
520
}
521
522
////////////////////////////////////////////////////////////////////////
523
//writeEepromValues Function
524
////////////////////////////////////////////////////////////////////////
525
//Write EEprom values
526
void
writeEepromValues(){
527
for
(
int
adr = 0; adr < outputQuantity; adr++) {
528
EEPROM.write(adr, outputStatus[adr]);
529
}
530
531
}
532
533
////////////////////////////////////////////////////////////////////////
534
//initEepromValues Function
535
////////////////////////////////////////////////////////////////////////
536
//Initialiaze EEprom values
537
//if eeprom values are not the correct format ie not euqual to 0 or 1 (thus greater then 1) initialize by putting 0
538
void
initEepromValues(){
539
for
(
int
adr = 0; adr < outputQuantity; adr++){
540
if
(EEPROM.read(adr) > 1){
541
EEPROM.write(adr, 0);
542
}
543
544
}
545
546
}
547
548
549
////////////////////////////////////////////////////////////////////////
550
//htmlHeader Function
551
////////////////////////////////////////////////////////////////////////
552
//Prints html header
553
void
printHtmlHeader(EthernetClient client){
554
Serial
.print(
"Serving html Headers at ms -"
);
555
timeConnectedAt = millis();
//Record the time when last page was served.
556
Serial
.print(timeConnectedAt);
// Print time for debbugging purposes
557
writeToEeprom =
true
;
// page loaded so set to action the write to eeprom
558
559
// send a standard http response header
560
client.println(
"HTTP/1.1 200 OK"
);
561
client.println(
"Content-Type: text/html"
);
562
client.println(
"Connnection: close"
);
563
client.println();
564
client.println(
"<!DOCTYPE HTML>"
);
565
client.println(
"<head>"
);
566
567
// add page title
568
client.println(
"<title>Ethernet Switching</title>"
);
569
client.println(
"<meta name=\"description\" content=\"Ethernet Switching\"/>"
);
570
571
// add a meta refresh tag, so the browser pulls again every x seconds:
572
client.print(
"<meta http-equiv=\"refresh\" content=\""
);
573
client.print(refreshPage);
574
client.println(
"; url=/\">"
);
575
576
// add other browser configuration
577
client.println(
"<meta name=\"apple-mobile-web-app-capable\" content=\"yes\">"
);
578
client.println(
"<meta name=\"apple-mobile-web-app-status-bar-style\" content=\"default\">"
);
579
client.println(
"<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\">"
);
580
581
//inserting the styles data, usually found in CSS files.
582
client.println(
"<style type=\"text/css\">"
);
583
client.println(
""
);
584
585
//This will set how the page will look graphically
586
client.println(
"html { height:100%; }"
);
587
588
client.println(
" body {"
);
589
client.println(
" height: 100%;"
);
590
client.println(
" margin: 0;"
);
591
client.println(
" font-family: helvetica, sans-serif;"
);
592
client.println(
" -webkit-text-size-adjust: none;"
);
593
client.println(
" }"
);
594
client.println(
""
);
595
client.println(
"body {"
);
596
client.println(
" -webkit-background-size: 100% 21px;"
);
597
client.println(
" background-color: #c5ccd3;"
);
598
client.println(
" background-image:"
);
599
client.println(
" -webkit-gradient(linear, left top, right top,"
);
600
client.println(
" color-stop(.75, transparent),"
);
601
client.println(
" color-stop(.75, rgba(255,255,255,.1)) );"
);
602
client.println(
" -webkit-background-size: 7px;"
);
603
client.println(
" }"
);
604
client.println(
""
);
605
client.println(
".view {"
);
606
client.println(
" min-height: 100%;"
);
607
client.println(
" overflow: auto;"
);
608
client.println(
" }"
);
609
client.println(
""
);
610
client.println(
".header-wrapper {"
);
611
client.println(
" height: 44px;"
);
612
client.println(
" font-weight: bold;"
);
613
client.println(
" text-shadow: rgba(0,0,0,0.7) 0 -1px 0;"
);
614
client.println(
" border-top: solid 1px rgba(255,255,255,0.6);"
);
615
client.println(
" border-bottom: solid 1px rgba(0,0,0,0.6);"
);
616
client.println(
" color: #fff;"
);
617
client.println(
" background-color: #8195af;"
);
618
client.println(
" background-image:"
);
619
client.println(
" -webkit-gradient(linear, left top, left bottom,"
);
620
client.println(
" from(rgba(255,255,255,.4)),"
);
621
client.println(
" to(rgba(255,255,255,.05)) ),"
);
622
client.println(
" -webkit-gradient(linear, left top, left bottom,"
);
623
client.println(
" from(transparent),"
);
624
client.println(
" to(rgba(0,0,64,.1)) );"
);
625
client.println(
" background-repeat: no-repeat;"
);
626
client.println(
" background-position: top left, bottom left;"
);
627
client.println(
" -webkit-background-size: 100% 21px, 100% 22px;"
);
628
client.println(
" -webkit-box-sizing: border-box;"
);
629
client.println(
" }"
);
630
client.println(
""
);
631
client.println(
".header-wrapper h1 {"
);
632
client.println(
" text-align: center;"
);
633
client.println(
" font-size: 20px;"
);
634
client.println(
" line-height: 44px;"
);
635
client.println(
" margin: 0;"
);
636
client.println(
" }"
);
637
client.println(
""
);
638
client.println(
".group-wrapper {"
);
639
client.println(
" margin: 9px;"
);
640
client.println(
" }"
);
641
client.println(
""
);
642
client.println(
".group-wrapper h2 {"
);
643
client.println(
" color: #4c566c;"
);
644
client.println(
" font-size: 17px;"
);
645
client.println(
" line-height: 0.8;"
);
646
client.println(
" font-weight: bold;"
);
647
client.println(
" text-shadow: #fff 0 1px 0;"
);
648
client.println(
" margin: 20px 10px 12px;"
);
649
client.println(
" }"
);
650
client.println(
""
);
651
client.println(
".group-wrapper h3 {"
);
652
client.println(
" color: #4c566c;"
);
653
client.println(
" font-size: 12px;"
);
654
client.println(
" line-height: 1;"
);
655
client.println(
" font-weight: bold;"
);
656
client.println(
" text-shadow: #fff 0 1px 0;"
);
657
client.println(
" margin: 20px 10px 12px;"
);
658
client.println(
" }"
);
659
client.println(
""
);
660
client.println(
".group-wrapper h4 {"
);
//Text for description
661
client.println(
" color: #212121;"
);
662
client.println(
" font-size: 14px;"
);
663
client.println(
" line-height: 1;"
);
664
client.println(
" font-weight: bold;"
);
665
client.println(
" text-shadow: #aaa 1px 1px 3px;"
);
666
client.println(
" margin: 5px 5px 5px;"
);
667
client.println(
" }"
);
668
client.println(
""
);
669
client.println(
".group-wrapper table {"
);
670
client.println(
" background-color: #fff;"
);
671
client.println(
" -webkit-border-radius: 10px;"
);
672
673
client.println(
" -moz-border-radius: 10px;"
);
674
client.println(
" -khtml-border-radius: 10px;"
);
675
client.println(
" border-radius: 10px;"
);
676
677
678
client.println(
" font-size: 17px;"
);
679
client.println(
" line-height: 20px;"
);
680
client.println(
" margin: 9px 0 20px;"
);
681
client.println(
" border: solid 1px #a9abae;"
);
682
client.println(
" padding: 11px 3px 12px 3px;"
);
683
client.println(
" margin-left:auto;"
);
684
client.println(
" margin-right:auto;"
);
685
686
client.println(
" -moz-transform :scale(1);"
);
//Code for Mozilla Firefox
687
client.println(
" -moz-transform-origin: 0 0;"
);
688
689
690
691
client.println(
" }"
);
692
client.println(
""
);
693
694
695
//how the green (ON) LED will look
696
client.println(
".green-circle {"
);
697
client.println(
" display: block;"
);
698
client.println(
" height: 23px;"
);
699
client.println(
" width: 23px;"
);
700
client.println(
" background-color: #0f0;"
);
701
//client.println(" background-color: rgba(60, 132, 198, 0.8);");
702
client.println(
" -moz-border-radius: 11px;"
);
703
client.println(
" -webkit-border-radius: 11px;"
);
704
client.println(
" -khtml-border-radius: 11px;"
);
705
client.println(
" border-radius: 11px;"
);
706
client.println(
" margin-left: 1px;"
);
707
708
client.println(
" background-image: -webkit-gradient(linear, 0% 0%, 0% 90%, from(rgba(46, 184, 0, 0.8)), to(rgba(148, 255, 112, .9)));@"
);
709
client.println(
" border: 2px solid #ccc;"
);
710
client.println(
" -webkit-box-shadow: rgba(11, 140, 27, 0.5) 0px 10px 16px;"
);
711
client.println(
" -moz-box-shadow: rgba(11, 140, 27, 0.5) 0px 10px 16px; /* FF 3.5+ */"
);
712
client.println(
" box-shadow: rgba(11, 140, 27, 0.5) 0px 10px 16px; /* FF 3.5+ */"
);
713
714
client.println(
" }"
);
715
client.println(
""
);
716
717
//how the black (off)LED will look
718
client.println(
".black-circle {"
);
719
client.println(
" display: block;"
);
720
client.println(
" height: 23px;"
);
721
client.println(
" width: 23px;"
);
722
client.println(
" background-color: #040;"
);
723
client.println(
" -moz-border-radius: 11px;"
);
724
client.println(
" -webkit-border-radius: 11px;"
);
725
client.println(
" -khtml-border-radius: 11px;"
);
726
client.println(
" border-radius: 11px;"
);
727
client.println(
" margin-left: 1px;"
);
728
client.println(
" -webkit-box-shadow: rgba(11, 140, 27, 0.5) 0px 10px 16px;"
);
729
client.println(
" -moz-box-shadow: rgba(11, 140, 27, 0.5) 0px 10px 16px; /* FF 3.5+ */"
);
730
client.println(
" box-shadow: rgba(11, 140, 27, 0.5) 0px 10px 16px; /* FF 3.5+ */"
);
731
client.println(
" }"
);
732
client.println(
""
);
733
734
//this will add the glare to both of the LEDs
735
client.println(
" .glare {"
);
736
client.println(
" position: relative;"
);
737
client.println(
" top: 1;"
);
738
client.println(
" left: 5px;"
);
739
client.println(
" -webkit-border-radius: 10px;"
);
740
client.println(
" -moz-border-radius: 10px;"
);
741
client.println(
" -khtml-border-radius: 10px;"
);
742
client.println(
" border-radius: 10px;"
);
743
client.println(
" height: 1px;"
);
744
client.println(
" width: 13px;"
);
745
client.println(
" padding: 5px 0;"
);
746
client.println(
" background-color: rgba(200, 200, 200, 0.25);"
);
747
client.println(
" background-image: -webkit-gradient(linear, 0% 0%, 0% 95%, from(rgba(255, 255, 255, 0.7)), to(rgba(255, 255, 255, 0)));"
);
748
client.println(
" }"
);
749
client.println(
""
);
750
751
752
//and finally this is the end of the style data and header
753
client.println(
"</style>"
);
754
client.println(
"</head>"
);
755
756
//now printing the page itself
757
client.println(
"<body>"
);
758
client.println(
"<div class=\"view\">"
);
759
client.println(
" <div class=\"header-wrapper\">"
);
760
client.println(
" <h1>Ethernet Switching</h1>"
);
761
client.println(
" </div>"
);
762
763
//////
764
765
}
//end of htmlHeader
766
767
////////////////////////////////////////////////////////////////////////
768
//htmlFooter Function
769
////////////////////////////////////////////////////////////////////////
770
//Prints html footer
771
void
printHtmlFooter(EthernetClient client){
772
//Set Variables Before Exiting
773
printLastCommandOnce =
false
;
774
printButtonMenuOnce =
false
;
775
allOn =
""
;
776
allOff =
""
;
777
778
//printing last part of the html
779
client.println(
"\n<h3 align=\"center\">© Author - Claudio Vella <br> Malta - October - 2012 - "
);
780
client.println(rev);
781
client.println(
"</h3></div>\n</div>\n</body>\n</html>"
);
782
783
delay(1);
// give the web browser time to receive the data
784
785
client.stop();
// close the connection:
786
787
Serial
.println(
" - Done, Closing Connection."
);
788
789
delay (2);
//delay so that it will give time for client buffer to clear and does not repeat multiple pages.
790
791
}
//end of htmlFooter
792
793
794
////////////////////////////////////////////////////////////////////////
795
//printHtmlButtonTitle Function
796
////////////////////////////////////////////////////////////////////////
797
//Prints html button title
798
void
printHtmlButtonTitle(EthernetClient client){
799
client.println(
"<div class=\"group-wrapper\">"
);
800
client.println(
" <h2>Switch the required output.</h2>"
);
801
client.println();
802
}
803
804
805
////////////////////////////////////////////////////////////////////////
806
//printLoginTitle Function
807
////////////////////////////////////////////////////////////////////////
808
//Prints html button title
809
void
printLoginTitle(EthernetClient client){
810
// client.println("<div class=\"group-wrapper\">");
811
client.println(
" <h2>Please enter the user data to login.</h2>"
);
812
client.println();
813
}
да совсем ничего сложного - больше времени потратил чтобы скачать. 2 сенсора требуют подтяжки шины к 5в. Сенсоров может быть столько(сейчас они заданы tSensors и их 2), на сколько у вас хватит памяти(по 8 байт на сенсор если не ошибаюсь).
Так с какой полки брать пирожок?
Гыы пыражок ему. Щас ты еще 2 дня будешь обьяснять кого, куда и на чем подтягивать. :)
ага. скетчик на полкарасика
Так с какой полки брать пирожок?
Дружище! черкани ка мне на почтовый ящик l400l@ya.ru нумбер телефона для пирожков, и свой ящик на всяк случай, куда можно писать. А то вдруг у меня в будущем ещё "полбайтовые" вопросики появятся
Да ладно - у нас первая доза всегда бесплатно! Про пирожок это я вообще чтобы веселее было написал.
Ну так мне хотелось продолжить мысль, и апргрейдить данный скетч дальше, навесив на него несложные логические действия, а вы первая доза... а как же дальнейшие дозы :)
Да и вообще чувствую себя халявщиком...