Introduction: Establishing a WiFi Connection With ESP8266 and Get the Local IP Address
In this tutorial we will see how to establish a WiFi connection with ESP8266 WiFi board.We will connect that with local WiFi network.
Step 1: Component Requird
Of course we need a WiFi board that will be ESP8266 WiFi board.
(if your PC not detecting your ESP8266 WiFi board please install the proper driver for ESP8266 in your PC)
Step 2: Connection
Just use the USB type A to USB micro B cable to connect board to the PC.
Step 3: Programming
Upload the below code in your ESP8266 board(use arduinoIDE to upload):
#include<ESP8266WiFi.h>
const char ssid[]="Repalce it with your ssid";
const char password[]="Replace it with your password";
void setup()
{
Serial.begin(115200);
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("Connected.");
Serial.println(WiFi.localIP());
}
void loop()
{
}
Comments