22
22
#include < WiFi.h>
23
23
24
24
25
- char ssid[] = " yourNetwork" ; // your network SSID (name)
25
+ char ssid[] = " yourNetwork" ; // your network SSID (name)
26
26
char pass[] = " secretPassword" ; // your network password
27
27
int keyIndex = 0 ; // your network key Index number (needed only for WEP)
28
28
@@ -78,12 +78,11 @@ void loop() {
78
78
// send a standard http response header
79
79
client.println (" HTTP/1.1 200 OK" );
80
80
client.println (" Content-Type: text/html" );
81
- client.println (" Connection: close" );
81
+ client.println (" Connection: close" ); // the connection will be closed after completion of the response
82
+ client.println (" Refresh: 5" ); // refresh the page automatically every 5 sec
82
83
client.println ();
83
84
client.println (" <!DOCTYPE HTML>" );
84
85
client.println (" <html>" );
85
- // add a meta refresh tag, so the browser pulls again every 5 seconds:
86
- client.println (" <meta http-equiv=\" refresh\" content=\" 5\" >" );
87
86
// output the value of each analog input pin
88
87
for (int analogChannel = 0 ; analogChannel < 6 ; analogChannel++) {
89
88
int sensorReading = analogRead (analogChannel);
@@ -108,9 +107,10 @@ void loop() {
108
107
}
109
108
// give the web browser time to receive the data
110
109
delay (1 );
111
- // close the connection:
112
- client.stop ();
113
- Serial.println (" client disonnected" );
110
+
111
+ // close the connection:
112
+ client.stop ();
113
+ Serial.println (" client disonnected" );
114
114
}
115
115
}
116
116
0 commit comments