ESP32 Expeditions:Chapter-1 Connecting ESP32 With WiFi

Once upon a time in the land of technology, there lived a young and curious programmer named Shemanto Sharkar 🧑‍💻. Shemanto had always been fascinated by the magical world of coding and the endless possibilities it held.

One day, Shemanto embarked on a remarkable journey to create a device that could connect to the vast and mysterious realm of the internet. To bring this idea to life, Shemanto held in their hands a powerful tool known as the Arduino board.

Shemanto’s adventure began in a small workshop filled with all sorts of electronic wonders and gadgets. With determination and a sparkle in their eye, Shemanto delved into writing a piece of code that would open the gateway to the internet.

With this library, Shemanto was ready to communicate with the WiFi network around them. It was like having a magical spellbook for forging a connection with the digital world.

Filled with excitement, Shemanto started their code with enthusiasm, setting up the communication with the computer.

They shared their vision with the computer, and then embarked on a quest to befriend a nearby WiFi network by sharing its name (SSID) and secret code (password). It was as if they were sending a message to the distant WiFi tower.

Yet, as in any adventure, challenges arose. Sometimes, the WiFi network seemed shy and unresponsive. So, Shemanto introduced a special loop to keep trying until success was achieved.

With each attempt, they called out to the computer, “Hey, I’m trying to make a new friend!”, and patiently waited for 2 seconds before making another attempt.

At last, the magical moment arrived. Shemanto’s device successfully made friends with the WiFi network, and they couldn’t contain their joy. They exclaimed, “Connected! Good to Go!”, celebrating their achievement.

With pride, Shemanto printed their unique internet address, feeling like a true explorer in the digital world.

As Shemanto looked at their code, they knew their adventure had only just begun. In the “loop” part of their code, there lay an empty canvas, waiting to be filled with magical tasks. They couldn’t wait to continue their journey, exploring the limitless possibilities that the internet had to offer. And so, with determination in their heart, Shemanto Sharkar embarked on their coding adventure, ready to make their mark in the digital realm. 🚀🌟📡🏡🎉

#include <WiFi.h>  // 🌐 We invite the WiFi library to help us connect to the internet.

void setup() {
  Serial.begin(115200);  // 🚀 We start talking to the computer at a certain speed (baud rate).
  WiFi.begin("Name", "Password");  // 📡 We try to make friends with a Wi-Fi network using a special name (SSID) and secret code (password).

  // 🔁 We keep trying to connect until we succeed.
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print("Trying to Connect!");  // 🗣 We say, "Hey, I'm trying to make a new friend!" to the computer.
    delay(2000);  // ⏳ We wait patiently for 2 seconds before trying again.
  }
  Serial.println();  // 📋 We say, "Let's start a new line."
  Serial.println("Connected! Good to Go!");  // 🎉 We shout, "Yay, we're connected to the internet!" to celebrate.
  Serial.println(WiFi.localIP());  // 🏡 We proudly announce our unique address on the internet.
}

void loop() {
  // This is where we can do our special tasks over and over again.
  // But right now, it's empty, like a blank page in a magical book.
}
0
Subscribe to my newsletter

Read articles from Shemanto's Coding Tales directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shemanto's Coding Tales
Shemanto's Coding Tales