الاتصال بـ WiFi في وضع Station
انضم إلى شبكتك واطبع عنوان IP.
الاتصال بـ WiFi في وضع Station درس مجاني في Arduino & IoT Academy على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Arduino & IoT Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Arduino & IoT Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
What Station Mode Is
When your board joins an existing network like a phone joins WiFi, that is Station mode. Your router is the host; the ESP is a guest. 📶
Include the Library
Everything starts by including the WiFi library. That one line gives you connect, status, and address functions.
#include <WiFi.h>Store Your Credentials
Save your network name and password in const char variables. Keeping them near the top makes them easy to update later.
const char* ssid = "MyNetwork";
const char* password = "secret123";SSID Is the Network Name
The SSID is simply the WiFi name you tap on your phone. It must match exactly, including capital letters and spaces.
Set the Mode
Tell the chip to act as a client with WiFi.mode(). Setting station mode keeps it from accidentally becoming its own hotspot.
WiFi.mode(WIFI_STA);Start the Connection
Kick things off with WiFi.begin(), passing your ssid and password. This starts the handshake with the router.
WiFi.begin(ssid, password);Connecting Takes Time
Joining is not instant. You wait in a loop and check WiFi.status() until it reports WL_CONNECTED.
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}Show Progress Dots
Printing a dot each loop gives friendly feedback. When the dots stop, your board has successfully joined the network.
Grab Your IP Address
Once connected, the router hands your board an IP address. Read it with WiFi.localIP() so you know how to reach the device.
Serial.println(WiFi.localIP());The IP Identifies the Device
That IP address is your board's home on the network. You type it in a browser later to open pages your ESP serves.
When It Will Not Connect
Stuck on dots forever? Double-check the password and SSID, and remember ESP boards only join 2.4 GHz networks, not 5 GHz.
Quick Check
After WiFi.begin runs, how do you confirm the board actually joined the network?
Recap
You joined a router in Station mode: include WiFi, set credentials, call begin, wait for WL_CONNECTED, then print your IP. 🎉
الأسئلة الشائعة
هل درس «الاتصال بـ WiFi في وضع Station» مجاني؟
نعم — نص درس «الاتصال بـ WiFi في وضع Station» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Arduino & IoT Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Arduino & IoT Academy 4 دروس في المجموع.
ماذا ستتعلم في «الاتصال بـ WiFi في وضع Station»؟
انضم إلى شبكتك واطبع عنوان IP. تتمرن على Arduino & IoT Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Arduino & IoT Academy؟
لا تُشترط خبرة سابقة. Arduino & IoT Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.
كم من الوقت يستغرق درس «الاتصال بـ WiFi في وضع Station»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Arduino & IoT Academy هذا؟
نعم. كل درس في Arduino & IoT Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- لماذا يناسب ESP32 وESP8266 إنترنت الأشياء
- إضافة لوحات ESP إلى IDE
- الاتصال بـ WiFi في وضع Station
- تشغيل صفحة إعداد Access Point