Skip to content

Commit 7ccafad

Browse files
authored
Merge pull request esp8266#2649 from WereCatf/WiFiClientExamples
Use WIFI_STA in WiFiClient-examples
2 parents 2f9b13c + d46d742 commit 7ccafad

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ void setup() {
2626
Serial.print("Connecting to ");
2727
Serial.println(ssid);
2828

29+
/* Explicitly set the ESP8266 to be a WiFi-client, otherwise, it by default,
30+
would try to act as both a client and an access-point and could cause
31+
network-issues with your other WiFi-devices on your WiFi-network. */
32+
WiFi.mode(WIFI_STA);
2933
WiFi.begin(ssid, password);
3034

3135
while (WiFi.status() != WL_CONNECTED) {

libraries/ESP8266WiFi/examples/WiFiClientEvents/WiFiClientEvents.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ void setup() {
3434

3535
WiFi.onEvent(WiFiEvent);
3636

37+
/* Explicitly set the ESP8266 to be a WiFi-client, otherwise, it by default,
38+
would try to act as both a client and an access-point and could cause
39+
network-issues with your other WiFi-devices on your WiFi-network. */
40+
WiFi.mode(WIFI_STA);
3741
WiFi.begin(ssid, password);
3842

3943
Serial.println();

0 commit comments

Comments
 (0)