Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit 42be38f

Browse files
authored
v1.10.1 to use new WiFi101_Generic library
### Releases v1.10.1 1. Using new [`WiFi101_Generic library`](https://github.com/khoih-prog/WiFi101_Generic) for sending larger data 2. Update `Packages' Patches`
1 parent 215d87c commit 42be38f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+5032
-4786
lines changed

examples/AP_SimpleWebServer/AP_SimpleWebServer.ino

+48-38
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
/****************************************************************************************************************************
22
AP_SimpleWebServer.ino - Simple Arduino WiFi Web Server LED Blink 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 lets you blink an LED via the web.
1212
This sketch will create a new access point (with no password).
1313
It will then launch a new server and print out the IP address
1414
to the Serial monitor. From there, you can open that address in a web browser
1515
to turn on and off the LED on pin 13.
16-
16+
1717
If the IP address of your board is yourAddress:
1818
http://yourAddress/H turns the LED on
1919
http://yourAddress/L turns it off
20-
20+
2121
created 25 Nov 2012
2222
by Tom Igoe
2323
adapted to WiFi AP by Adafruit
@@ -48,16 +48,16 @@ void printWiFiStatus()
4848

4949
#if (ESP32 || ESP8266)
5050
IPAddress ip = WiFi.softAPIP();
51-
#else
51+
#else
5252

5353
// print the SSID of the network you're attached to:
5454
Serial.print(F("SSID: "));
55-
55+
5656
Serial.println(WiFi.SSID());
57-
57+
5858
IPAddress ip = WiFi.localIP();
5959
#endif
60-
60+
6161
Serial.print(F("IP Address: "));
6262
Serial.println(ip);
6363

@@ -70,12 +70,15 @@ void setup()
7070
{
7171
//Initialize serial and wait for port to open:
7272
Serial.begin(115200);
73+
7374
while (!Serial && millis() < 5000);
7475

7576
delay(200);
7677

77-
Serial.print(F("\nStarting AP_SimpleWebServer on ")); Serial.print(BOARD_NAME);
78-
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
78+
Serial.print(F("\nStarting AP_SimpleWebServer on "));
79+
Serial.print(BOARD_NAME);
80+
Serial.print(F(" with "));
81+
Serial.println(SHIELD_TYPE);
7982
Serial.println(WIFI_WEBSERVER_VERSION);
8083

8184
pinMode(led, OUTPUT); // set the LED pin mode
@@ -88,32 +91,35 @@ void setup()
8891
WiFi.init(&EspSerial);
8992

9093
Serial.println(F("WiFi shield init done"));
91-
94+
9295
#endif
9396

9497
#if !(ESP32 || ESP8266)
95-
98+
9699
// check for the presence of the shield
97-
#if USE_WIFI_NINA
98-
if (WiFi.status() == WL_NO_MODULE)
99-
#else
100-
if (WiFi.status() == WL_NO_SHIELD)
101-
#endif
102-
{
103-
Serial.println(F("WiFi shield not present"));
104-
// don't continue
105-
while (true);
106-
}
100+
#if USE_WIFI_NINA
101+
102+
if (WiFi.status() == WL_NO_MODULE)
103+
#else
104+
if (WiFi.status() == WL_NO_SHIELD)
105+
#endif
106+
{
107+
Serial.println(F("WiFi shield not present"));
108+
109+
// don't continue
110+
while (true);
111+
}
112+
113+
#if USE_WIFI_NINA
114+
String fv = WiFi.firmwareVersion();
115+
116+
if (fv < WIFI_FIRMWARE_LATEST_VERSION)
117+
{
118+
Serial.println(F("Please upgrade the firmware"));
119+
}
120+
121+
#endif
107122

108-
#if USE_WIFI_NINA
109-
String fv = WiFi.firmwareVersion();
110-
111-
if (fv < WIFI_FIRMWARE_LATEST_VERSION)
112-
{
113-
Serial.println(F("Please upgrade the firmware"));
114-
}
115-
#endif
116-
117123
#endif
118124

119125
// by default the local IP address of will be 192.168.4.1
@@ -129,23 +135,25 @@ void setup()
129135
#if (ESP32 || ESP8266)
130136

131137
WiFi.softAP(ssid, pass);
132-
138+
133139
#else
134140

135141
// Create open network. Change this line if you want to create an WEP network:
136142
// default AP channel = 1
137143
uint8_t ap_channel = 2;
138144

139145
status = WiFi.beginAP(ssid, pass, ap_channel);
140-
146+
141147
//status = WiFi.beginAP(ssid, pass);
142148

143149
if (status != WL_AP_LISTENING)
144150
{
145151
Serial.println(F("Creating access point failed"));
152+
146153
// don't continue
147154
while (true);
148155
}
156+
149157
#endif
150158

151159
// wait 10 seconds for connection:
@@ -161,6 +169,7 @@ void setup()
161169
void loop()
162170
{
163171
#if !(ESP32 || ESP8266)
172+
164173
// compare the previous status to the current status
165174
if (status != WiFi.status())
166175
{
@@ -172,13 +181,14 @@ void loop()
172181
{
173182
// a device has connected to the AP
174183
Serial.println(F("Device connected to AP"));
175-
}
184+
}
176185
else
177186
{
178187
// a device has disconnected from the AP, and we are back in listening mode
179188
Serial.println(F("Device disconnected from AP"));
180-
}
189+
}
181190
}
191+
182192
#endif
183193

184194
WiFiClient client = server.available(); // listen for incoming clients
@@ -188,7 +198,7 @@ void loop()
188198
// if you get a client,
189199
Serial.println(F("New client")); // print a message out the serial port
190200
String currentLine = ""; // make a String to hold incoming data from the client
191-
201+
192202
while (client.connected())
193203
{
194204
// loop while the client's connected
@@ -237,14 +247,14 @@ void loop()
237247
{
238248
digitalWrite(led, HIGH); // GET /H turns the LED on
239249
}
240-
250+
241251
if (currentLine.endsWith(F("GET /L")))
242252
{
243253
digitalWrite(led, LOW); // GET /L turns the LED off
244254
}
245255
}
246256
}
247-
257+
248258
// close the connection:
249259
client.stop();
250260
Serial.println(F("Client disconnected"));

examples/AP_SimpleWebServer/defines.h

+57-57
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/****************************************************************************************************************************
22
defines.h
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
@@ -20,71 +20,71 @@
2020

2121
#if ( defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4) )
2222

23-
#if defined(BOARD_NAME)
24-
#undef BOARD_NAME
25-
#endif
23+
#if defined(BOARD_NAME)
24+
#undef BOARD_NAME
25+
#endif
2626

27-
#if defined(CORE_CM7)
28-
#warning Using Portenta H7 M7 core
29-
#define BOARD_NAME "PORTENTA_H7_M7"
30-
#else
31-
#warning Using Portenta H7 M4 core
32-
#define BOARD_NAME "PORTENTA_H7_M4"
33-
#endif
27+
#if defined(CORE_CM7)
28+
#warning Using Portenta H7 M7 core
29+
#define BOARD_NAME "PORTENTA_H7_M7"
30+
#else
31+
#warning Using Portenta H7 M4 core
32+
#define BOARD_NAME "PORTENTA_H7_M4"
33+
#endif
34+
35+
#define USE_WIFI_PORTENTA_H7 true
3436

35-
#define USE_WIFI_PORTENTA_H7 true
37+
#define USE_WIFI_NINA false
3638

37-
#define USE_WIFI_NINA false
39+
// To use the default WiFi library here
40+
#define USE_WIFI_CUSTOM false
3841

39-
// To use the default WiFi library here
40-
#define USE_WIFI_CUSTOM false
41-
4242
#elif (ESP32)
4343

44-
#define USE_WIFI_NINA false
44+
#define USE_WIFI_NINA false
4545

46-
// To use the default WiFi library here
47-
#define USE_WIFI_CUSTOM false
46+
// To use the default WiFi library here
47+
#define USE_WIFI_CUSTOM false
4848

4949
#elif (ESP8266)
5050

51-
#define USE_WIFI_NINA false
51+
#define USE_WIFI_NINA false
5252

53-
// To use the default WiFi library here
54-
#define USE_WIFI_CUSTOM true
53+
// To use the default WiFi library here
54+
#define USE_WIFI_CUSTOM true
5555

5656
#elif ( defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRWIFI1010) )
5757

58-
#define USE_WIFI_NINA false
59-
#define USE_WIFI101 true
60-
#define USE_WIFI_CUSTOM false
58+
#define USE_WIFI_NINA false
59+
#define USE_WIFI101 true
60+
#define USE_WIFI_CUSTOM false
6161

6262
#elif ( defined(ARDUINO_NANO_RP2040_CONNECT) || defined(ARDUINO_SAMD_NANO_33_IOT) )
6363

64-
#define USE_WIFI_NINA true
65-
#define USE_WIFI101 false
66-
#define USE_WIFI_CUSTOM false
64+
#define USE_WIFI_NINA true
65+
#define USE_WIFI101 false
66+
#define USE_WIFI_CUSTOM false
6767

6868
#elif defined(ARDUINO_RASPBERRY_PI_PICO_W)
69-
70-
#define USE_WIFI_NINA false
71-
#define USE_WIFI101 false
72-
#define USE_WIFI_CUSTOM false
73-
69+
70+
#define USE_WIFI_NINA false
71+
#define USE_WIFI101 false
72+
#define USE_WIFI_CUSTOM false
73+
7474
#elif ( defined(__AVR_ATmega4809__) || defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined(ARDUINO_AVR_NANO_EVERY) || \
7575
defined(ARDUINO_AVR_ATmega4809) || defined(ARDUINO_AVR_ATmega4808) || defined(ARDUINO_AVR_ATmega3209) || \
7676
defined(ARDUINO_AVR_ATmega3208) || defined(ARDUINO_AVR_ATmega1609) || defined(ARDUINO_AVR_ATmega1608) || \
7777
defined(ARDUINO_AVR_ATmega809) || defined(ARDUINO_AVR_ATmega808) )
78-
79-
#error Not supported. Lack of memory for megaAVR
80-
81-
#else
8278

83-
#define USE_WIFI_NINA false
84-
#define USE_WIFI101 false
85-
86-
// If not USE_WIFI_NINA, you can USE_WIFI_CUSTOM, then include the custom WiFi library here
87-
#define USE_WIFI_CUSTOM true
79+
#error Not supported. Lack of memory for megaAVR
80+
81+
#else
82+
83+
#define USE_WIFI_NINA false
84+
#define USE_WIFI101 false
85+
86+
// If not USE_WIFI_NINA, you can USE_WIFI_CUSTOM, then include the custom WiFi library here
87+
#define USE_WIFI_CUSTOM true
8888

8989
#endif
9090

@@ -116,32 +116,32 @@
116116
#define SHIELD_TYPE "ESP WiFi using WiFi Library"
117117
#elif defined(ARDUINO_RASPBERRY_PI_PICO_W)
118118
#warning Using RP2040W CYW43439 WiFi
119-
#define SHIELD_TYPE "RP2040W CYW43439 WiFi"
119+
#define SHIELD_TYPE "RP2040W CYW43439 WiFi"
120120
#elif USE_WIFI_CUSTOM
121121
#warning Using Custom WiFi using Custom WiFi Library
122122
#define SHIELD_TYPE "Custom WiFi using Custom WiFi Library"
123123
#else
124-
#define SHIELD_TYPE "Unknown WiFi shield/Library"
124+
#define SHIELD_TYPE "Unknown WiFi shield/Library"
125125
#endif
126126

127127
#if ( defined(NRF52840_FEATHER) || defined(NRF52832_FEATHER) || defined(NRF52_SERIES) || defined(ARDUINO_NRF52_ADAFRUIT) || \
128128
defined(NRF52840_FEATHER_SENSE) || defined(NRF52840_ITSYBITSY) || defined(NRF52840_CIRCUITPLAY) || defined(NRF52840_CLUE) || \
129129
defined(NRF52840_METRO) || defined(NRF52840_PCA10056) || defined(PARTICLE_XENON) || defined(NINA_B302_ublox) || defined(NINA_B112_ublox) )
130-
#if defined(WIFI_USE_NRF528XX)
131-
#undef WIFI_USE_NRF528XX
132-
#endif
133-
#define WIFI_USE_NRF528XX true
130+
#if defined(WIFI_USE_NRF528XX)
131+
#undef WIFI_USE_NRF528XX
132+
#endif
133+
#define WIFI_USE_NRF528XX true
134134
#endif
135135

136136
#if ( defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRWIFI1010) \
137137
|| defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_SAMD_MKRFox1200) || defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) \
138138
|| defined(ARDUINO_SAMD_MKRGSM1400) || defined(ARDUINO_SAMD_MKRNB1500) || defined(ARDUINO_SAMD_MKRVIDOR4000) || defined(__SAMD21G18A__) \
139139
|| defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS) || defined(__SAMD21E18A__) || defined(__SAMD51__) || defined(__SAMD51J20A__) || defined(__SAMD51J19A__) \
140140
|| defined(__SAMD51G19A__) || defined(__SAMD51P19A__) || defined(__SAMD21G18A__) )
141-
#if defined(WIFI_USE_SAMD)
142-
#undef WIFI_USE_SAMD
143-
#endif
144-
#define WIFI_USE_SAMD true
141+
#if defined(WIFI_USE_SAMD)
142+
#undef WIFI_USE_SAMD
143+
#endif
144+
#define WIFI_USE_SAMD true
145145
#endif
146146

147147
#if ( defined(ARDUINO_SAM_DUE) || defined(__SAM3X8E__) )
@@ -155,10 +155,10 @@
155155
#if ( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
156156
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
157157
defined(STM32WB) || defined(STM32MP1) ) && ! ( defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4) )
158-
#if defined(WIFI_USE_STM32)
159-
#undef WIFI_USE_STM32
160-
#endif
161-
#define WIFI_USE_STM32 true
158+
#if defined(WIFI_USE_STM32)
159+
#undef WIFI_USE_STM32
160+
#endif
161+
#define WIFI_USE_STM32 true
162162
#endif
163163

164164
#ifdef CORE_TEENSY
@@ -381,7 +381,7 @@
381381
#define BOARD_NAME BOARD_TYPE
382382
#else
383383
#define BOARD_NAME "Unknown Board"
384-
#endif
384+
#endif
385385
#endif
386386

387387
#include <WiFiWebServer.h>

0 commit comments

Comments
 (0)