Connecting to WiFi With SS ID and Password

Updated: Feb 27, 2020

  • You need to have working WiFi connection or mobile Hotspot

  • download required library if error occurs regarding library

  • Save file as “wifi setup”

Source code for Download as follows:-


#include <ESP8266WiFi.h>

#include <LiquidCrystal_I2C.h>

const char* ssid = "TP-Link_29F0";

const char* password = "000123574689";

LiquidCrystal_I2C lcd(0x3F, 16, 2);


void setup()

{

lcd.begin();

lcd.backlight();

delay(10);

lcd.clear();

lcd.setCursor(0, 0);

WiFi.mode(WIFI_AP_STA);

WiFi.begin(ssid, password);

while(WiFi.waitForConnectResult() != WL_CONNECTED)

{

WiFi.begin(ssid, password);

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("WiFi failed,wait.");

delay(1000);

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("check for Error");

delay(400);

lcd.setCursor(0, 1);

lcd.print("If ok Wait.....");

}

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("WiFi connected");

delay(100);

lcd.clear();

lcd.setCursor(0, 0);

lcd.print("IP address: ");

delay(500);

lcd.setCursor(0, 1);

lcd.print(WiFi.localIP());

delay(1500);

}

void loop()

{ lcd.clear();

lcd.setCursor(0, 0);

lcd.print("Task complete");

delay(100);

lcd.setCursor(0, 1);

lcd.print("IP address: ");

delay(800);

lcd.setCursor(0, 1);

lcd.print(WiFi.localIP());

delay(1500);

}


  • Circuit Diagram





20 views0 comments

Recent Posts

See All