← सभी पोस्ट ब्लॉग पोस्ट

ESP8266 को ऑनलाइन करना: WiFi सेटअप गाइड

Viktoria Builds

ESP8266 बोर्ड को Arduino IDE में जोड़ने और एक सरल WiFi कनेक्शन स्केच लिखने का तरीका। बोर्ड मैनेजर URL और वर्किंग उदाहरण कोड के साथ GitHub रेपो शामिल है।

YouTube पर देखें

Arduino IDE में बोर्ड सेट होने के बाद ESP8266 को WiFi से कनेक्ट करना आश्चर्यजनक रूप से सरल है। यहाँ कुछ मिनटों में ऑनलाइन होने के लिए वह सब कुछ है जो आपको चाहिए।

Arduino IDE में ESP8266 बोर्ड इंस्टॉल करें

Arduino IDE खोलें, File → Preferences पर जाएं, और Additional Boards Manager URLs फ़ील्ड में निम्नलिखित URL पेस्ट करें:

http://arduino.esp8266.com/stable/package_esp8266com_index.json

फिर Tools → Board → Boards Manager पर जाएं, esp8266 खोजें, और ESP8266 Community द्वारा पैकेज इंस्टॉल करें।

अपना बोर्ड चुनें

Tools → Board पर जाएं और अपना वेरिएंट चुनें। NodeMCU के लिए NodeMCU 1.0 (ESP-12E Module) चुनें। सुनिश्चित करें कि Tools → Port के अंतर्गत सही पोर्ट चुना गया है।

कोड

पूरा सोर्स: github.com/viktoriabuilds/esp8266-wifi-tutorial

#include <ESP8266WiFi.h>

const char* ssid     = "Your SSID";
const char* password = "Your Password";

int ledPin = 13;

void setup() {
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);

  Serial.begin(115200);
  Serial.println();
  Serial.print("Wifi connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);

  Serial.println();
  Serial.print("Connecting");

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

  digitalWrite(ledPin, HIGH);
  Serial.println();
  Serial.println("Wifi Connected Success!");
  Serial.print("NodeMCU IP Address : ");
  Serial.println(WiFi.localIP());
}

void loop() {
  // your code here
}

स्केच अपलोड करें और Serial Monitor को 115200 baud पर खोलें। ESP8266 कनेक्ट होगा और अपना लोकल IP एड्रेस प्रिंट करेगा। कनेक्ट होने पर पिन 13 पर LED जल जाएगी।

अगले कदम

एक बार कनेक्ट होने के बाद आप HTTP अनुरोध कर सकते हैं, एक छोटा वेब पेज सर्व कर सकते हैं, या सेंसर डेटा को क्लाउड API पर भेज सकते हैं।

यह ट्यूटोरियल पसंद आया?

Patreon पर चैनल को सपोर्ट करें और प्रोजेक्ट्स, बिल्ड लॉग्स और बहुत कुछ तक जल्दी पहुंचें।

Patreon पर सपोर्ट करें →