esp8266 arduino ide code example

Example 1: esp8266 arduino

#include <ESP8266WiFi.h>

void setup()
{
  Serial.begin(115200);
  Serial.println();

  WiFi.begin("network-name", "pass-to-network");

  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println();

  Serial.print("Connected, IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {}

Example 2: esp8266 arduino

Serial.printf("Connection status: %d\n", WiFi.status());

Example 3: esp8266 arduino

WiFi.printDiag(Serial);

Example 4: esp8266 arduino

Serial.println(WiFi.localIP());

Example 5: esp8266 arduino

Connecting....
Connected, IP address: 192.168.1.10

Example 6: esp8266 arduino

Serial.printf("Wi-Fi mode set to WIFI_STA %s\n", WiFi.mode(WIFI_STA) ? "" : "Failed!");