11/* ***************************************************************************************************************************
22 WebClient.ino - Simple Arduino web server sample for SAMD21 running WiFiNINA shield
33 For any WiFi shields, such as WiFiNINA W101, W102, W13x, or custom, such as ESP8266/ESP32-AT, Ethernet, etc
4-
4+
55 WiFiWebServer is a library for the ESP32-based WiFi shields to run WebServer
66 Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases
77 Based on and modified from Arduino WiFiNINA library https://www.arduino.cc/en/Reference/WiFiNINA
88 Built by Khoi Hoang https://github.com/khoih-prog/WiFiWebServer
99 Licensed under MIT license
10-
10+
1111 A simple web server that shows the value of the analog input pins via a web page using an ESP8266 module.
1212 This sketch will start an access point and print the IP address of your ESP8266 module to the Serial monitor.
1313 From there, you can open that address in a web browser to display the web page.
1414 The web page will be automatically refreshed each 20 seconds.
15-
15+
1616 For more details see: http://yaab-arduino.blogspot.com/p/wifiesp.html
1717 ***************************************************************************************************************************************/
1818#include " defines.h"
@@ -47,7 +47,7 @@ void setup()
4747 while (!Serial);
4848
4949 Serial.print (F (" \n Starting WebClient on " )); Serial.print (BOARD_NAME);
50- Serial.print (F (" with " )); Serial.println (SHIELD_TYPE);
50+ Serial.print (F (" with " )); Serial.println (SHIELD_TYPE);
5151 Serial.println (WIFI_WEBSERVER_VERSION);
5252
5353#if WIFI_USING_ESP_AT
@@ -58,46 +58,46 @@ void setup()
5858 WiFi.init (&EspSerial);
5959
6060 Serial.println (F (" WiFi shield init done" ));
61-
61+
6262#endif
6363
6464#if !(ESP32 || ESP8266)
65-
65+
6666 // check for the presence of the shield
67- #if USE_WIFI_NINA
68- if (WiFi.status () == WL_NO_MODULE)
69- #else
70- if (WiFi.status () == WL_NO_SHIELD)
71- #endif
72- {
73- Serial.println (F (" WiFi shield not present" ));
74- // don't continue
75- while (true );
76- }
77-
78- #if USE_WIFI_NINA
79- String fv = WiFi.firmwareVersion ();
80-
81- if (fv < WIFI_FIRMWARE_LATEST_VERSION)
82- {
83- Serial.println (F (" Please upgrade the firmware" ));
84- }
85- #endif
86-
67+ #if USE_WIFI_NINA
68+ if (WiFi.status () == WL_NO_MODULE)
69+ #else
70+ if (WiFi.status () == WL_NO_SHIELD)
71+ #endif
72+ {
73+ Serial.println (F (" WiFi shield not present" ));
74+ // don't continue
75+ while (true );
76+ }
77+
78+ #if USE_WIFI_NINA
79+ String fv = WiFi.firmwareVersion ();
80+
81+ if (fv < WIFI_FIRMWARE_LATEST_VERSION)
82+ {
83+ Serial.println (F (" Please upgrade the firmware" ));
84+ }
85+ #endif
86+
8787#endif
8888
8989 Serial.print (F (" Connecting to SSID: " ));
9090 Serial.println (ssid);
91-
91+
9292 status = WiFi.begin (ssid, pass);
9393
9494 delay (1000 );
95-
95+
9696 // attempt to connect to WiFi network
9797 while ( status != WL_CONNECTED)
9898 {
9999 delay (500 );
100-
100+
101101 // Connect to WPA/WPA2 network
102102 status = WiFi.status ();
103103 }
@@ -120,7 +120,7 @@ void setup()
120120 }
121121}
122122
123- void printoutData (void )
123+ void printoutData ()
124124{
125125 // if there are incoming bytes available
126126 // from the server, read them and print them
0 commit comments