0Pricing
Arduino & IoT Academy · Lektion

Einen BLE-Dienst bekanntgeben

Machen Sie Ihren ESP32 sichtbar, damit ein Smartphone ihn finden kann.

Einen BLE-Dienst bekanntgeben ist eine kostenlose Arduino & IoT Academy-Lektion auf CoddyKit. Dies ist Lektion 2 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Arduino & IoT Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Arduino & IoT Academy-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

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. ✨

Häufig gestellte Fragen

Ist die Lektion „Einen BLE-Dienst bekanntgeben“ kostenlos?

Ja — der vollständige Text von „Einen BLE-Dienst bekanntgeben“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Arduino & IoT Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Arduino & IoT Academy-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Einen BLE-Dienst bekanntgeben“?

Machen Sie Ihren ESP32 sichtbar, damit ein Smartphone ihn finden kann. Du übst Arduino & IoT Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.

Brauche ich Erfahrung, um Arduino & IoT Academy zu starten?

Keine Vorkenntnisse erforderlich. Arduino & IoT Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 2 von 4.

Wie lange dauert die Lektion „Einen BLE-Dienst bekanntgeben“?

Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.

Kann ich in dieser Arduino & IoT Academy-Lektion Code schreiben und ausführen?

Ja. Jede Arduino & IoT Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.

Alle Lektionen in diesem Kurs

  1. Klassisches Bluetooth vs. BLE
  2. Einen BLE-Dienst bekanntgeben
  3. Characteristics lesen und schreiben
  4. Eine LED über eine Smartphone-App steuern
← Zurück zu Arduino & IoT Academy