1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| #include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
BLECharacteristic * ch;
void setup() {
BLEDevice::init("ESP32 BLE");
auto s = BLEDevice::createServer();
auto svc = s -> createService(BLEUUID((uint16_t) 0x180A));
ch = svc -> createCharacteristic(BLEUUID((uint16_t) 0x2A57), BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE);
ch -> setValue("hi");
svc -> start();
BLEDevice::startAdvertising();
}
void loop() {}
|