ble-beacon-sender.ino
BLE server configuration to broadcast data without active client connection.
Uses the native BLE stack of the ESP32-S3. The kit broadcasts the name 'PaperDIY_Beacon'. Use an app like 'nRF Connect' on phone to scan and see data. Ideal for local notifications or presence identifiers.
ble-beacon-sender.ino
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
#define SERVICE_UUID "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"
BLECharacteristic *pCharacteristic;
void setup() {
Serial.begin(115200);
BLEDevice::init("PaperDIY_Beacon");
BLEServer *pServer = BLEDevice::createServer();
BLEService *pService = pServer->createService(SERVICE_UUID);
pCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID,
BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE
);
pCharacteristic->setValue("Hello World");
pService->start();
BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
pAdvertising->addServiceUUID(SERVICE_UUID);
pAdvertising->start();
Serial.println("BLE Advertising started");
}
void loop() {
delay(1000);
}