Skip to content
CommunicationLGPL-2.1vBundled with ESP8266 Arduino core 3.1.2

ESP8266WiFi

by ESP8266 Community

ESP8266WiFi is the core Wi-Fi stack bundled with the ESP8266 Arduino core, providing station mode (joining a network), access-point mode (hosting one), and the underlying `WiFiClient`/`WiFiServer` classes that HTTP, MQTT, and OTA libraries build on top of. Unlike an add-on shield, this is baked into the chip's SDK, so there's nothing extra to install beyond selecting an ESP8266 board in the Arduino IDE. The catch that trips people up is that `WiFi.begin()` is non-blocking — it kicks off the connection attempt and returns immediately, so a `while (WiFi.status() != WL_CONNECTED)` loop with a short delay is required before using the network, otherwise code that assumes an instant connection will fail intermittently depending on network conditions.

Installation

Arduino IDE — Library Manager

Sketch → Include Library → Manage Libraries → search Bundled with ESP8266 board package (Boards Manager)

PlatformIO

lib_deps = platform = espressif8266

Supported boards

ESP8266

Examples

Connect to a Wi-Fi network

Baseline connection pattern behind every ESP8266 networked project on this site.

#include <ESP8266WiFi.h>

void setup() {
  Serial.begin(115200);
  WiFi.begin("ssid", "password");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println(WiFi.localIP());
}

void loop() {}