esp8266 code example

Example 1: esp8266 arduino

#include 

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

WiFi.printDiag(Serial);

Example 3: esp8266 wifi example

// Load Wi-Fi library
#include 

Example 4: esp8266 arduino

Serial.println(WiFi.localIP());

Example 5: esp8266 arduino

Connectingscandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt

connected with sensor-net, channel 6
dhcp client start...
chg_B1:-40
...ip:192.168.1.10,mask:255.255.255.0,gw:192.168.1.9
.
Connected, IP address: 192.168.1.10

Example 6: esp8266 wifi example

// Auxiliar variables to store the current output state
String output5State = "off";
String output4State = "off";

Tags:

Misc Example