EasyManuals Logo

Freenove ESP32 User Manual

Default Icon
159 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #130 background imageLoading...
Page #130 background image
Need support? support@freenove.com
128
Chapter 13 BLE
www.freenove.com
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
void bleSetup() {
// Create the BLE Device
String s = String("Freenove-Dog");
BLEDevice::init(std::string(s.c_str()));
BLEDevice::setMTU(512);
// Create the BLE Server
pServer = BLEDevice::createServer();
pServer->setCallbacks(new MyServerCallbacks());
// Create the BLE Service
BLEService *pService = pServer->createService(SERVICE_UUID);
// Create a BLE Characteristic
pTxCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID_TX,
BLECharacteristic::PROPERTY_NOTIFY);
pTxCharacteristic->addDescriptor(new BLE2902());
BLECharacteristic *pRxCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID_RX,
BLECharacteristic::PROPERTY_WRITE);
pRxCharacteristic->setCallbacks(new MyCallbacks());
// Start the service
pService->start();
// Start advertising
pServer->getAdvertising()->start();
Serial.println("Bluetooth initialization complete, Waiting a client connection to notify...");
}
void bleStop() {
BLEDevice::deinit();
}
void bleSend(std::string msg) {
if (isBleConnected) {
pTxCharacteristic->setValue(msg);
pTxCharacteristic->notify();
}
}

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Freenove ESP32 and is the answer not in the manual?

Freenove ESP32 Specifications

General IconGeneral
BrandFreenove
ModelESP32
CategoryComputer Hardware
LanguageEnglish

Related product manuals