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

Commit

Permalink
v1.10.1 to use new WiFi101_Generic library
Browse files Browse the repository at this point in the history
### 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`
  • Loading branch information
khoih-prog authored Nov 24, 2022
1 parent 42be38f commit 0e927b5
Show file tree
Hide file tree
Showing 24 changed files with 733 additions and 660 deletions.
66 changes: 36 additions & 30 deletions examples/HTTPClient/BasicAuthGet/BasicAuthGet.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
BasicAuthGet.ino - Simple Arduino web server sample for WiFi shield
For any WiFi shields, such as WiFiNINA W101, W102, W13x, or custom, such as ESP8266/ESP32-AT, Ethernet, etc
WiFiWebServer is a library for the ESP32-based WiFi shields to run WebServer
Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases
Based on and modified from Arduino WiFiNINA library https://www.arduino.cc/en/Reference/WiFiNINA
Expand Down Expand Up @@ -51,10 +51,13 @@ void printWifiStatus()
void setup()
{
Serial.begin(115200);

while (!Serial && millis() < 5000);

Serial.print(F("\nStarting BasicAuthGet on ")); Serial.print(BOARD_NAME);
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
Serial.print(F("\nStarting BasicAuthGet on "));
Serial.print(BOARD_NAME);
Serial.print(F(" with "));
Serial.println(SHIELD_TYPE);
Serial.println(WIFI_WEBSERVER_VERSION);

#if WIFI_USING_ESP_AT
Expand All @@ -65,46 +68,49 @@ void setup()
WiFi.init(&EspSerial);

Serial.println(F("WiFi shield init done"));

#endif

#if !(ESP32 || ESP8266)

// check for the presence of the shield
#if USE_WIFI_NINA
if (WiFi.status() == WL_NO_MODULE)
#else
if (WiFi.status() == WL_NO_SHIELD)
#endif
{
Serial.println(F("WiFi shield not present"));
// don't continue
while (true);
}

#if USE_WIFI_NINA
String fv = WiFi.firmwareVersion();

if (fv < WIFI_FIRMWARE_LATEST_VERSION)
{
Serial.println(F("Please upgrade the firmware"));
}
#endif

#if USE_WIFI_NINA

if (WiFi.status() == WL_NO_MODULE)
#else
if (WiFi.status() == WL_NO_SHIELD)
#endif
{
Serial.println(F("WiFi shield not present"));

// don't continue
while (true);
}

#if USE_WIFI_NINA
String fv = WiFi.firmwareVersion();

if (fv < WIFI_FIRMWARE_LATEST_VERSION)
{
Serial.println(F("Please upgrade the firmware"));
}

#endif

#endif

Serial.print(F("Connecting to SSID: "));
Serial.println(ssid);

status = WiFi.begin(ssid, pass);

delay(1000);

// attempt to connect to WiFi network
while ( status != WL_CONNECTED)
{
delay(500);

// Connect to WPA/WPA2 network
status = WiFi.status();
}
Expand All @@ -113,7 +119,7 @@ void setup()
printWifiStatus();
}

void loop()
void loop()
{
Serial.println("making GET request with HTTP basic authentication");
httpClient.beginRequest();
Expand All @@ -129,7 +135,7 @@ void loop()
Serial.println(statusCode);
Serial.print("Response: ");
Serial.println(response);

Serial.println("Wait five seconds");
delay(5000);
}
50 changes: 25 additions & 25 deletions examples/HTTPClient/BasicAuthGet/defines.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/****************************************************************************************************************************
defines.h
For any WiFi shields, such as WiFiNINA W101, W102, W13x, or custom, such as ESP8266/ESP32-AT, Ethernet, etc
WiFiWebServer is a library for the ESP32-based WiFi shields to run WebServer
Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases
Based on and modified from Arduino WiFiNINA library https://www.arduino.cc/en/Reference/WiFiNINA
Expand Down Expand Up @@ -36,21 +36,21 @@

#define USE_WIFI_NINA false

// To use the default WiFi library here
// To use the default WiFi library here
#define USE_WIFI_CUSTOM false

#elif (ESP32)

#define USE_WIFI_NINA false

// To use the default WiFi library here
// To use the default WiFi library here
#define USE_WIFI_CUSTOM false

#elif (ESP8266)

#define USE_WIFI_NINA false

// To use the default WiFi library here
// To use the default WiFi library here
#define USE_WIFI_CUSTOM true

#elif ( defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRWIFI1010) )
Expand All @@ -66,23 +66,23 @@
#define USE_WIFI_CUSTOM false

#elif defined(ARDUINO_RASPBERRY_PI_PICO_W)

#define USE_WIFI_NINA false
#define USE_WIFI101 false
#define USE_WIFI_CUSTOM false

#elif defined(ARDUINO_AVR_UNO_WIFI_REV2)

#define USE_WIFI_NINA false
#define USE_WIFI101 true
#define USE_WIFI_CUSTOM false

#else

#define USE_WIFI_NINA false
#define USE_WIFI101 false
// If not USE_WIFI_NINA, you can USE_WIFI_CUSTOM, then include the custom WiFi library here

// If not USE_WIFI_NINA, you can USE_WIFI_CUSTOM, then include the custom WiFi library here
#define USE_WIFI_CUSTOM true

#endif
Expand Down Expand Up @@ -115,32 +115,32 @@
#define SHIELD_TYPE "ESP WiFi using WiFi Library"
#elif defined(ARDUINO_RASPBERRY_PI_PICO_W)
#warning Using RP2040W CYW43439 WiFi
#define SHIELD_TYPE "RP2040W CYW43439 WiFi"
#define SHIELD_TYPE "RP2040W CYW43439 WiFi"
#elif USE_WIFI_CUSTOM
#warning Using Custom WiFi using Custom WiFi Library
#define SHIELD_TYPE "Custom WiFi using Custom WiFi Library"
#else
#define SHIELD_TYPE "Unknown WiFi shield/Library"
#define SHIELD_TYPE "Unknown WiFi shield/Library"
#endif

#if ( defined(NRF52840_FEATHER) || defined(NRF52832_FEATHER) || defined(NRF52_SERIES) || defined(ARDUINO_NRF52_ADAFRUIT) || \
defined(NRF52840_FEATHER_SENSE) || defined(NRF52840_ITSYBITSY) || defined(NRF52840_CIRCUITPLAY) || defined(NRF52840_CLUE) || \
defined(NRF52840_METRO) || defined(NRF52840_PCA10056) || defined(PARTICLE_XENON) || defined(NINA_B302_ublox) || defined(NINA_B112_ublox) )
#if defined(WIFI_USE_NRF528XX)
#undef WIFI_USE_NRF528XX
#endif
#define WIFI_USE_NRF528XX true
#if defined(WIFI_USE_NRF528XX)
#undef WIFI_USE_NRF528XX
#endif
#define WIFI_USE_NRF528XX true
#endif

#if ( defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRWIFI1010) \
|| defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_SAMD_MKRFox1200) || defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) \
|| defined(ARDUINO_SAMD_MKRGSM1400) || defined(ARDUINO_SAMD_MKRNB1500) || defined(ARDUINO_SAMD_MKRVIDOR4000) || defined(__SAMD21G18A__) \
|| defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS) || defined(__SAMD21E18A__) || defined(__SAMD51__) || defined(__SAMD51J20A__) || defined(__SAMD51J19A__) \
|| defined(__SAMD51G19A__) || defined(__SAMD51P19A__) || defined(__SAMD21G18A__) )
#if defined(WIFI_USE_SAMD)
#undef WIFI_USE_SAMD
#endif
#define WIFI_USE_SAMD true
#if defined(WIFI_USE_SAMD)
#undef WIFI_USE_SAMD
#endif
#define WIFI_USE_SAMD true
#endif

#if ( defined(ARDUINO_SAM_DUE) || defined(__SAM3X8E__) )
Expand All @@ -154,10 +154,10 @@
#if ( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
defined(STM32WB) || defined(STM32MP1) ) && ! ( defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4) )
#if defined(WIFI_USE_STM32)
#undef WIFI_USE_STM32
#endif
#define WIFI_USE_STM32 true
#if defined(WIFI_USE_STM32)
#undef WIFI_USE_STM32
#endif
#define WIFI_USE_STM32 true
#endif

#ifdef CORE_TEENSY
Expand Down Expand Up @@ -380,7 +380,7 @@
#define BOARD_NAME BOARD_TYPE
#else
#define BOARD_NAME "Unknown Board"
#endif
#endif
#endif

#include <WiFiHttpClient.h>
Expand Down
66 changes: 36 additions & 30 deletions examples/HTTPClient/CustomHeader/CustomHeader.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
CustomHeader.ino - Simple Arduino web server sample for WiFi shield
For any WiFi shields, such as WiFiNINA W101, W102, W13x, or custom, such as ESP8266/ESP32-AT, Ethernet, etc
WiFiWebServer is a library for the ESP32-based WiFi shields to run WebServer
Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases
Based on and modified from Arduino WiFiNINA library https://www.arduino.cc/en/Reference/WiFiNINA
Expand Down Expand Up @@ -48,10 +48,13 @@ void printWifiStatus()
void setup()
{
Serial.begin(115200);

while (!Serial && millis() < 5000);

Serial.print(F("\nStarting CustomHeader on ")); Serial.print(BOARD_NAME);
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
Serial.print(F("\nStarting CustomHeader on "));
Serial.print(BOARD_NAME);
Serial.print(F(" with "));
Serial.println(SHIELD_TYPE);
Serial.println(WIFI_WEBSERVER_VERSION);

#if WIFI_USING_ESP_AT
Expand All @@ -62,46 +65,49 @@ void setup()
WiFi.init(&EspSerial);

Serial.println(F("WiFi shield init done"));

#endif

#if !(ESP32 || ESP8266)

// check for the presence of the shield
#if USE_WIFI_NINA
if (WiFi.status() == WL_NO_MODULE)
#else
if (WiFi.status() == WL_NO_SHIELD)
#endif
{
Serial.println(F("WiFi shield not present"));
// don't continue
while (true);
}

#if USE_WIFI_NINA
String fv = WiFi.firmwareVersion();

if (fv < WIFI_FIRMWARE_LATEST_VERSION)
{
Serial.println(F("Please upgrade the firmware"));
}
#endif

#if USE_WIFI_NINA

if (WiFi.status() == WL_NO_MODULE)
#else
if (WiFi.status() == WL_NO_SHIELD)
#endif
{
Serial.println(F("WiFi shield not present"));

// don't continue
while (true);
}

#if USE_WIFI_NINA
String fv = WiFi.firmwareVersion();

if (fv < WIFI_FIRMWARE_LATEST_VERSION)
{
Serial.println(F("Please upgrade the firmware"));
}

#endif

#endif

Serial.print(F("Connecting to SSID: "));
Serial.println(ssid);

status = WiFi.begin(ssid, pass);

delay(1000);

// attempt to connect to WiFi network
while ( status != WL_CONNECTED)
{
delay(500);

// Connect to WPA/WPA2 network
status = WiFi.status();
}
Expand All @@ -110,11 +116,11 @@ void setup()
printWifiStatus();
}

void loop()
void loop()
{
Serial.println("Making GET request");
httpClient.beginRequest();

httpClient.get("/");
httpClient.sendHeader("X-CUSTOM-HEADER", "custom_value");
httpClient.endRequest();
Expand Down
Loading

0 comments on commit 0e927b5

Please sign in to comment.