1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-07 16:23:38 +03:00

Merge pull request #2649 from WereCatf/WiFiClientExamples

Use WIFI_STA in WiFiClient-examples
This commit is contained in:
Ivan Grokhotkov 2016-11-14 11:02:00 -06:00 committed by GitHub
commit 7ccafadb41
2 changed files with 8 additions and 0 deletions

View File

@ -26,6 +26,10 @@ void setup() {
Serial.print("Connecting to "); Serial.print("Connecting to ");
Serial.println(ssid); Serial.println(ssid);
/* Explicitly set the ESP8266 to be a WiFi-client, otherwise, it by default,
would try to act as both a client and an access-point and could cause
network-issues with your other WiFi-devices on your WiFi-network. */
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password); WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) { while (WiFi.status() != WL_CONNECTED) {

View File

@ -34,6 +34,10 @@ void setup() {
WiFi.onEvent(WiFiEvent); WiFi.onEvent(WiFiEvent);
/* Explicitly set the ESP8266 to be a WiFi-client, otherwise, it by default,
would try to act as both a client and an access-point and could cause
network-issues with your other WiFi-devices on your WiFi-network. */
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password); WiFi.begin(ssid, password);
Serial.println(); Serial.println();