0Pricing
Arduino & IoT Academy · درس

الإعلان عن خدمة BLE

اجعل ESP32 ظاهرًا حتى يتمكن الهاتف من العثور عليه.

الإعلان عن خدمة BLE درس مجاني في Arduino & IoT Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Arduino & IoT Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Arduino & IoT Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Make Your Board Findable

Before a phone can connect, your ESP32 must announce itself. This shouting into the air is called advertising. 📣

What Advertising Sends

Advertising broadcasts tiny packets with your device name and what it offers, so nearby phones can list it without connecting yet.

Start with the Library

The Arduino core gives you a BLE library. Include it once, then everything for advertising and connecting becomes a few clean calls.

#include <BLEDevice.h>
#include <BLEServer.h>

Name Your Device

First you initialize BLE and give your board a friendly name. That name is what users will tap in their phone's Bluetooth list.

BLEDevice::init("Smart-Sensor");

Create a Server

Your board acts as a BLE server: it holds the data, and the phone is the client that asks for it. Create the server next.

BLEServer *server = BLEDevice::createServer();

What a Service Is

A service is a labeled group of related data, like all the values for one sensor. A device can offer several services at once.

Services Need a UUID

Each service is identified by a UUID, a long unique code. The phone uses this exact id to find the right service among many.

BLEService *svc = server->createService("180F");

Standard vs Custom UUIDs

Short UUIDs like 180F are official standard ones. For your own data, generate a long custom UUID so it never clashes with others.

Start the Service

Once the service is defined, you must start it. Until you do, the phone cannot actually use any of its data.

svc->start();

Begin Advertising

Finally, tell the radio to advertise. Now the board broadcasts its name and service so phones nearby can discover it.

server->getAdvertising()->start();

Find It on Your Phone

Open a scanner app like nRF Connect and you should see Smart-Sensor appear. Seeing your name means advertising works.

Quick Check

You wrote a service but the phone shows no data inside it.

Recap

Init BLE, name the board, make a server, add a service with a UUID, start it, then advertise. Now your device is discoverable. ✨

الأسئلة الشائعة

هل درس «الإعلان عن خدمة BLE» مجاني؟

نعم — نص درس «الإعلان عن خدمة BLE» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Arduino & IoT Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Arduino & IoT Academy 4 دروس في المجموع.

ماذا ستتعلم في «الإعلان عن خدمة BLE»؟

اجعل ESP32 ظاهرًا حتى يتمكن الهاتف من العثور عليه. تتمرن على Arduino & IoT Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Arduino & IoT Academy؟

لا تُشترط خبرة سابقة. Arduino & IoT Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.

كم من الوقت يستغرق درس «الإعلان عن خدمة BLE»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Arduino & IoT Academy هذا؟

نعم. كل درس في Arduino & IoT Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. Bluetooth الكلاسيكي مقابل BLE
  2. الإعلان عن خدمة BLE
  3. قراءة Characteristics وكتابتها
  4. التحكم في LED من تطبيق هاتف
← العودة إلى Arduino & IoT Academy