2222#include < WiFi.h>
2323
2424
25- char ssid[] = " yourNetwork" ; // your network SSID (name)
25+ char ssid[] = " yourNetwork" ; // your network SSID (name)
2626char pass[] = " secretPassword" ; // your network password
2727int keyIndex = 0 ; // your network key Index number (needed only for WEP)
2828
@@ -78,12 +78,11 @@ void loop() {
7878 // send a standard http response header
7979 client.println (" HTTP/1.1 200 OK" );
8080 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
8283 client.println ();
8384 client.println (" <!DOCTYPE HTML>" );
8485 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\" >" );
8786 // output the value of each analog input pin
8887 for (int analogChannel = 0 ; analogChannel < 6 ; analogChannel++) {
8988 int sensorReading = analogRead (analogChannel);
@@ -108,9 +107,10 @@ void loop() {
108107 }
109108 // give the web browser time to receive the data
110109 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" );
114114 }
115115}
116116
0 commit comments